나는 다음과 같은 설정이 : 나는 내 자신의 클래스를 생성하고 신원 클래스에서 상속하여 IdentityUser 및 IdentityRole 클래스를 정의했습니다Asp.net 신원 DbContext
을
또한 내가했습니다있어 (edmx-디자이너를 통해) 엔티티 프레임 워크를 기반으로 내 도메인 모델
내 일반 도메인 모델에있는 클래스를 사용하여 IdentityUser을 확장하려는 때문에, 전 C 생성 된 파일의 <#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : IdentityDbContext<ApplicationUser>
외부 데이터 컨텍스트의 TT 매달아, 그래서 같은 ApplicationDataContext에서 부분 클래스를 만들었 :
public partial class ApplicationDbContext
{
protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<IdentityUser>().ToTable("User", "portal").Property(p => p.Id).HasColumnName("UserId");
modelBuilder.Entity<ApplicationUser>().ToTable("User", "portal").Property(p => p.Id).HasColumnName("UserId");
modelBuilder.Entity<IdentityUserRole>().ToTable("UserRoles", "portal");
modelBuilder.Entity<IdentityUserLogin>().ToTable("UserLogins", "portal");
modelBuilder.Entity<IdentityUserClaim>().ToTable("UserClaims", "portal");
modelBuilder.Entity<UserStoreAssignment>().ToTable("UserStoreAssignment", "portal");
modelBuilder.Entity<ApplicationRole>().ToTable("Roles", "portal");
}
new public DbSet<ApplicationRole> Roles { get; set; }
}
클래스 UserStoreAssignment
지점에 위치한 클래스 Store
에 도메인 모델 모든 것이 성공적으로 구축 될 수 있습니다.
엔티티 타입 ApplicationUser이 현재 컨텍스트에 대한 모델의 일부가 아닌 :하지만 최대한 빨리 내 응용 프로그램 내에서
ApplicationUser
접근을 시작으로, 나는 다음과 같은 오류 메시지가 나타납니다.
누구에게 어떤 문제가있을 수 있습니까?