神刀安全网

Development Approach with Entity Framework

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

Development Approach with Entity Framework

(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.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Development Approach with Entity Framework

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
分享按钮