Enterprise Application Architecture with .NET Core
by Ganesan Senthilvel, Ovais Mehboob Ahmed Khan, Habib Qureshi
Creating Data Context
When working with the code first model of Entity Framework, we need to define our custom context class, which should be derived from the DbContext class. Any class that inherits from the DbContext class is used to perform the database manipulation on the entities. In our case, we will use IdentityDbContext, which is a wrapper on the DbContext class and takes the IdentityUser object. IdentityDbContext is a generic base class, which can be customized with entity types that extend from the IdentityUser types.
Given next is the DataContext class, which contains the DbSet property for each entity. DbSet represents the entity set that is used to create, update, delete, and read records from a particular table to which the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access