What is the purpose of a DBContext class?

Technology CommunityCategory: Entity FrameworkWhat is the purpose of a DBContext class?
VietMX Staff asked 3 years ago

You can think of DbContext as the database connection and a set of tables, and DbSet as a representation of the tables themselves. The DbContext allows you to link your model properties (presumably using the Entity Framework) to your database with a connection string.

Later, when you wish to refer to a database in your controller to handle data, you reference the DbContext.