Search code examples
asp.net-mvcdatabasecontrollerdatacontext

ASP.NET MVC4 data context class dropdown in mvc project


I am using ASP.NET MVC4 to create a project and also want to use a SQL Server database.

When I am trying to add a controller, two dropdowns show up:

  1. Model class
  2. Data Context class

I know about model class but I don't have any idea about the Data Context class. Please guide me - what should I select from dropdown of Data Context class? There are four to five options in dropdown.

Here is snapshot


Solution

  • Data context is a class derived from DbContext. Using it, you specify your database model for them, and in this way, your methods are determined based on the entered Data Context.