Skip to main content
A newer version of this page is available.

Use Entity Framework with an Existing Database

With Entity Framework (EF), you can generate the business model from an existing database instead of creating it from scratch. To learn more about the Database First approach in EF, refer to the following MSDN tutorials.

Depending on the Visual Studio version and the code generation strategy, the entity model can be created within the DbContext or ObjectContext entity container. Refer to the Use the Entity Framework Data Model topic to learn how to use these containers in XAF.

Note

In the Entity Data Model Wizard it is recommended to leave the Pluralize or singularize generated object names option checked by default when adding or updating data model from an existing database. This way identification of primary and foreign key properties will be automatic according to the default naming conventions.

See Also