Database First and Model First

There are two distinctive methods to work with an Abstract Entity Model: Database First and Model First. Both are described more in detail below. The LLBLGen Pro designer doesn't force you to work in one method or the the other, you can mix them at any time, yet you should try to stick with one method and only sparsely use the functionality meant for the other method.

Database First

Database First or Database-driven is the method LLBLGen Pro v2.x worked: it reverse engineered an Abstract Entity Model from a set of database schema elements. Schematically it looks like the following:

Database 1st

Schematic overview of Database-first

The idea behind Database First is that the Database Schema Elements, e.g. tables, views, foreign key constraints and the like, were once created using an Abstract Entity Model and to look at the Database Schema Elements, one can reverse engineer them to an Abstract Entity Model which is roughly the same, or represents the same, as the database schema elements are projection results of the Abstract Entity Model.

If a project needs to target an existing database, this way of working with an Abstract Entity Model can be preferable over Model-first, as the Database Schema Elements can't be created through projecting an Abstract Entity Model onto a schema element as it's already there.

Model First

Model First or Model-driven is the method where the Abstract Entity Model is created first and the mappings as well as the database schema elements follow from that model. Schematically it looks like the following:

Model first

Schematic overview of Model-first

The idea behind Model First is that there's nothing defined yet, and the theoretical path of what's been discussed in O/R Mapping should be followed: build an Abstract Entity Model and use that to produce the code elements and database schema elements as both are projections from the Abstract Entity Model.

In the LLBLGen Pro designer, when working Model First, you're working directly on the Abstract Entity Model by manipulating the Entity Definitions which represent the Abstract Entity Definitions in the domain. Model First is ideal when there's no database schema yet.