Instead of giving title of the question as "What is advantages and usage for this", it could have been "What is advantages and usage for DbContext" so that readers know by reading the title itself whether they can answer or not. The chances of reply with good and understandable title increases and you get quicker solution to your problem.
Here is the answer of your question ...
DbContext is nothing but an Entity Framework primary class object that has reference to the database connection string and objects (like tables, stored procedures, views etc.).
When you instantiate this class and call its method and properties, internally Entity Framework makes an SQL statement for you and execute against the database and you get the data in collections, or manipulate the data.
So assume the DbContext object as an your primary database access layer object that can manipulate all objects of your database.
When you add Entity Framework separately, you get an option to add tables, views, stored procedures etc.
In MVC, the Entity Framework base class is already created in the Models > IdentityModels.cs file and when you add a controller, a DbSet<model> property gets added so that you can access that entities data.
Read more about Entity Framework at
http://techfunda.com/howto/asp-net-mvc/entity-framework.
Thanks
Regards,
Sheo Narayan
http://www.dotnetfunda.com
Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator