What is the purpose of a db context class in asp.net mvc

asp.net-mvc c# entity-framework

Question

I'm new to MVC and have followed some tutorials to get the feel of it, but in some of these, I've come across an example with a DbContext class tutorial for asp.net mvc5 with EF6.

I tried looking for information about DbContext Class, but I couldn't find anything that helped me understand it better! I also searched for the class on msdn under the number Zzz-12-Zzz, but all I could find were more of the same lessons with scant information.

My issue is: Do I need to use a context class, and what are the benefits of utilizing a DbContext Class? I have completed prior tutorials without a db context class, and it works just fine.

Any assistance would be greatly appreciated.

1
23
8/2/2019 2:54:27 PM

Accepted Answer

First, let me say that theDbContext Class related to Enterprise Framework (EF), but judging on the question tags, you probably already knew that. Typically used, coming from theDbContext To add EF-based data access into your application, use the class In what. derived from the classDbContext is essentially your application's data access layer.

To put it another way, if you wish to use Entity Framework for data access,DbContext what you desire.

22
8/11/2015 11:18:02 PM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow