Modal first approach means we can create Entities, relationships, and inheritance hierarchies on the entity.
In the first article i shown you that how to create Entity data modal.
Step(1): In entity Data Modal for “Modal first approach” Go to solution explorer and add new item and select Ado.Net entity data modal and give the name for this. After click in add you will see “ entity data Modal wizard” from there you select Empty EF designer modal.
Step(2 ): Hare When you will click on finish yow will see a empty screen (.edmx) there you right click and select “Entity” from Add New Point
Step(3):When you will click on Entity a new screen will popup there you give Entity name and click OK
Step(4): We can also add properties in the generated entity by right clicking on entity - > Add New -> Scalar property.
Give the name for Scalar property
Same way we can add Entity and association through toolbox. Go to toolbox and select EntityFramework.
Step(5) After creating Entity ,association right click on designer surfer and select “Generate Database from Modal”.
Step(6): When you will click on generate database from modal” you will see a screen there you give the connection name and click on next
After click on Next DDL database modal will show there you click on finish.
Step(7): After click on finish This will add ModelName.edmx.sql file in the project. You can execute DDL scripts in Visual Studio by opening .sql file -> right click -> Execute.
Now, we can generate context class and entities by right clicking on the designer and select Add Code Generation Item..
This will add (ModelName).Context.tt and (ModelName).tt with context class and entity classes as shown below.
So in this way, you can design your db model.