Different development styles:
There are different reasons, when the developer needs to design the database first.
- Separate teams working on the application and the database in the organization
- The application being developed is a data centric application
- Based on these conceptual domain models,the database tables will be created, and the application will implement the business logic in terms of these conceptual business models
- we are creating an application that is highly domain-centric, and the application contains the domain models implemented as classes
Different Entity Framework Approaches
Entity Framework provides support for all these development styles in 3 ways.
- Database First Approach
- Code First Approach
- Model First Approach
(The image is refered from entityframeworktutorial.net)
Database First Approach
You can use Database First approach with an existing database schema. In this approach, the EDM will be created from the database schema. This approach is best suited for applications that use an already existing database.
Database approach is useful for:
- When we are working with a legacy database
- When we are working in a scenario where the database design is being done by another team and the application development starts only when database is ready
- When we are working on a data centric application
Code First Approach
You can use this approach when you have existing domain classes.These classes will constitute your EDM. The database schema will be created from these models. This approach is best suited for applications that are highly domain-centric and will have the domain model classes created first. The database here is needed only as a persistencemechanism for these domain models.Code First approach is useful for:
- There isno logic is in the database
- Full control over the code, that is, there is no auto-generated model and context code
- The database will not be changed manually
Model First Approach
This approach is very similar to the Code First approach, but in this case, we use a visual EDM designer to design our models. The database schema and the classes will be generated by this conceptual model. The model will give us the SQL statements needed to create the database, and we can use it to create our database and connect up with our application.Model First approach is useful for:
- When you really want to use the Visual Entity Designer
Thanks for visiting !!
© 2016,admin. All rights reserved.