InterviewSolution
| 1. |
Explain different development approaches with the Entity framework. |
|
Answer» Three different development approaches will be provided by the Entity framework while dealing with the database and data access layer in the application according to the NEED of the project. They are: Database-First APPROACH: This approach will be used if there is an already existing database schema. Here, context and entities will be generated for the existing database using the EDM(Entity Data Model) wizard. This approach is considered to be the best for applications that will make USE of an already existing database. The Database-First approach is useful in the following cases:
Code-First Approach: This approach is used when the existing database is not present for your application. In this approach, you will write the entities(domain classes) and context classes, then the database will be created from these classes with the help of migration commands. This approach is considered to be the best for highly domain-centric applications and that will create the domain model classes in the beginning. Here, the database will be required only as a persistence mechanism for these newly created domain models. That implies, if a developer is following the principles of Domain-Driven Design(DDD), they will start the coding with the creation of domain classes and then the database required will be generated for persisting their data. The Code First approach is useful in the following situations:
Model-First Approach: In this approach, the entities, inheritance hierarchies, and relationships will be created directly on the visual DESIGNER and then can generate context class, database script, and entities using the visual model. The Model-First approach is useful in the situation:
|
|