안녕 얘들 아, 표준 AspNet 테이블에서 상속을 시도하고있다.Microsoft Identity 사용자 지정 사용자, 역할, 보상 상속
제 의도는 Guid를 기본 키로 사용하고 기본 AspNetUser 을 일부 속성으로 확장하는 것이 었습니다. 또한 테이블 이름의 이름을 바꾸려고했습니다.
는 지금은 같은 것입니다 :
public class User : IdentityUser<Guid, UserLogin, UserRole, UserClaim>
{
public User() { }
public User(string userName)
{
this.UserName = userName;
}
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<User, Guid> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
내 DbContext는 다음과 같습니다
public class CustomDBContext : IdentityDbContext<User, Role, Guid, UserLogin, UserRole, UserClaim>
{
public static CustomDBContext Create()
{
return new CustomDBContext();
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<IdentityRole<Guid, UserRole>>().ToTable("Roles");
modelBuilder.Entity<IdentityUserLogin<Guid>>().ToTable("UserLogins");
modelBuilder.Entity<IdentityUserClaim<Guid>>().ToTable("UserClaims");
modelBuilder.Entity<IdentityUserRole<Guid>>().ToTable("UserRoles");
modelBuilder.Entity<IdentityUser<Guid, UserLogin, UserRole, UserClaim>>().ToTable("Users");
}
}
불행하게도 때 내 마이그레이션을 생성하기 위해 노력하고 스피. 오류가 발생합니다.
The type 'Microsoft.AspNet.Identity.EntityFramework.IdentityRole`2[System.Guid,Easy1WebAPIData.Models.UserRole]' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive or generic, and does not inherit from EntityObject.
아이디어가 있으십니까? 친애하는!