From the course: ASP.NET Core Identity: Authentication Management

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Default model configuration and generic types

Default model configuration and generic types - ASP.NET Core Tutorial

From the course: ASP.NET Core Identity: Authentication Management

Start my 1-month free trial

Default model configuration and generic types

- [Instructor] In ASP.NET Core, identity defines many context classes that inherit from the DbContext to configure and use the model. Now, this configuration is done using the Entity Framework Core called First Fluent API in the Context class inside the OnModelCreating methods. So, let us go to our solution and see how we can modify our Context class to change the default model configuration. So for that, in our Solution Explorer, let us expand the first project and then, go inside the data folder where we have the application DbContext file. We know that this file is our Context file because it inherits from the IdentityDbContext base class. Scroll down to the OnModelCreating method, and this is the method when we need to make the necessary changes to change the default model configuration. For demo purposes, let us just change the Identity user model. So for that, after the base.OnModelCreating, write builder.Entity, and then here we need to define that the entity that we want to…

Contents