Join Class

Model First Approach in Entity Framework Example

In Model first approach we design the model first and then based on model-objects we design the database objects.

Before you start with model first approach, I just want to make sure you have read other two approaches, database first approach and code first approach.

Because understanding of how entity framework works will help you to understand model first approach better, and you must have some understanding of EDMX file.

Entity Framework Model First Approach

Create a new ASP.NET MVC Project, by clicking New > Project > ASP.NET MVC Web Application >

First we create an empty model in our project

entity framework model first approach

Now we create two business entities in our model, and when we run the project, our database tables will be created automatically

entity framework model first approach
Personally I feel model first approach is not the ideal for large ongoing projects, because every time we want to make changes, we need to use that tool, incase if any other entities get overridden, then that will increase our testing time, on the other hand, opening code and making changes is much more secure and faster way, we know exactly what changes we have made, and what would be the effect.
So, I prefer going with code first approach
Model First in Entity Framework
Learn entity framework orm using c#, entity framework core and earlier version of entity framework, all tutorials are written in c#.
Entity Framework Interview Questions

SQL interview questions
Entity Framework C# Examples | Join .Net C# Course