Web
Analytics
Entity Framework Code First Approach with Database Initializers example - Tutorial

For Consultation : +91 9887575540

Stay Connected :

In this example we are discussing about Code first approach in entity framework , he will see that how we can create database table into database using code first approach.

Step 1. Create New Empty MVC Project

1





2

3

Step 2. Install Entity framework using package manager console or nuget package manager

4

 

5





Step 3: Add new Model class Emploee.css

67

Step 5 .Employee.CS

Step 6: Create connection string into web.config file

Step 7. Create new DataContext class in Models Folder.





Step 8: Update Global.asax

Step 10: Create Home Controller and Index.cshtml view.

Step11 . Run Project

Ouput : Two Database tables will be created Employee and Migration_Histore

Download Complete Source Code




Select your currency