In this article we are learning about the Model First Approach of the Entity Framework.
IntroductionIn the previous articles we learned about the Code First Approach and Database First Approach of Entity Framework.
The Model First Approach provides the option to create entities and relationships directly on the design interface of the EDMX and then we can execute it. A quick start Create an application.Add new item.Add ADO.NET Entity Data Model.Select Empty Model.Right-click on the designer then select Add New => Entity.Enter the entity name in this Wzard.Right-click and add the new scalar property.Then click on the option Generate Database from Model.Enter the Sever details and DB Name.Our connection details are here.In the Summary and Settings, click on Finish.Now our MyModel.edmx.sql file has been created.Right-click on the file then select Execute.Add a Code Generation item.All the files are created in the solution.Check with the DB server, the database and tables are created.If we need to update/add new items in/to the model, add the item in the model and generate the db then our .sql file will update and execute the file again.Conclusion In this article we learned the basic details of the Model First Approach of the Entity Framework.
.NET Interview Questions and Answer: Practical Implementation