Database connection with Multiple Tables using Entity Framework in ASP.Net MVC

Last Reply 3 months ago By dharmendr

Posted 3 months ago

I am new to MVC. I am just confused with the database connection.

I have referred some kuduvenkat youtube videos.

There they have used 2 ways.

like 1st way is that they have adding model ie Model----> add new item---> Dataentity model.

Then tables are selected. based on thar Er diagram is coming.

2nd way is like they have a class in model like:

 

public class EmployeeContext:DbContext
    {
        public DbSet<Department> Departments { get; set; }
        public DbSet<Employee> Employees { get; set; }
    }

What to use for the database connection in MVC? Any help will be appreciated.