Database-First Approach in Entity Framework and other ORMs

There are two ways of creating ORM models - Model-First approach and Database-First approach. Entity Developer supports both approaches for designing Entity Framework, NHibernate, LinqConnect, Telerik Data Access, and LINQ to SQL models.

Database-First approach allows you to use legacy database in your ORM application. It supposes that you already have existing database and build your entity model based on this database.

How to Start

Generating Model from Database via Wizard

In Visual Studio Entity Data Models, entities are generated from the database tables with help of Entity Data Model Wizard. Entity Developer supports wizard-based model generation from the database not only for Entity Framework, but for all the supported ORMs. Entity Developer's Create Model Wizard offers more features than EDM wizard, such as automatic detection of TPT inheritances, many-to-many associations, etc.

Generating model from database

Dragging Tables to Model Diagrams

In LINQ to SQL models, entities are generated by dragging database tables from Server Explorer to the diagram. Entity Developer implements both ways of generating entities from database tables - with Create Model Wizard and by dragging database tables from Database Explorer to the diagram for all the supported ORMs.

Dragging tables from Database Explorer

Flexible Naming Rules

Entity Developer allows flexible tweaking for the generated names of the entity sets, classes, methods and their members. You may configure case and pluralization, removing and adding of prefixes and suffixes, etc. Naming rules can be set up on the corresponding Create Model wizard page or in the Model Settings dialog box.

Naming rules

 

Advanced Model Mapping Tweaking Tools

Entity Developer offers many additional visual tools to configure mapping aspects, that cannot be automatically generated from database. Creating inheritance hierarchies is very easy and can be performed completely without manual editing of XML code. For Entity Framework you may map entities to one or more tables or split table to two separate entities, create entities (Defining Query) and procedures (Command Text) from SQL statements, use complex types, and edit the storage part of the model.

Mapping tools

 

Easy Updating Model from Database

When developing a model using the Database-First approach you may need to make changes to your database and then reflect these changes in your model. With Entity Developer, you can use Update From Database Wizard that allows synchronizing your model with the database for all the supported ORMs in a fast and convenient way.

In Visual Studio, the Update Wizard performs such updating for Entity Framework models. However, when updating model, the wizard resets all manual changes to the model. Unlike standard Visual Studio Update Wizard, Entity Developer Update From Database Wizard tries to preserve manual changes to the model where possible. The wizard detects all the database changes that can affect the model, e.g. created and deleted tables and views, their columns and foreign keys, column datatype changes, created and deleted stored procedures and functions, changes to their parameters etc.

Updating model from database