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

Last Reply 19 days ago By dharmendr

Posted 20 days 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.