سؤال

I'm creating a new MVC application which uses Windows Authentication using Microsoft OWIN.

I want to create repositories for all the classes belonging to the database for authentication, therefore I've customized the IdentityDbContext class as follows:

public class nDataContext : IdentityDbContext<ApplicationUser, ApplicationRole, string, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim>

public class ApplicationRole : IdentityRole<string, ApplicationUserRole>
{ }

public class ApplicationUser : IdentityUser<string, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim>
{ }

public class ApplicationUserClaim : IdentityUserClaim<string>
{ }

public class ApplicationUserLogin : IdentityUserLogin<string>
{ }

public class ApplicationUserRole : IdentityUserRole<string>
{ }

However, when I want to upgrade the database using the package manager command, I'll receive the following error:

The entity type IdentityRole is not part of the model for the current context.

Anyone who can point me in the right direction?

هل كانت مفيدة؟

المحلول

I've managed to find a solution. In the IdentityManager, I was still using the interface instead of the Implementation (ApplicationRole).

That solved the issue.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top