I custom Ignore claims an logins entity when register i get error
public class ApplicationUser : IdentityUser { public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager) { var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here return userIdentity; } } public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext() : base("DefaultConnection", throwIfV1Schema: false) { Database.SetInitializer<ApplicationDbContext>(new AuthInitializer()); } public static ApplicationDbContext Create() { return new ApplicationDbContext(); } protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Ignore<IdentityUserLogin>(); modelBuilder.Ignore<IdentityUserClaim>(); modelBuilder.HasDefaultSchema("auth"); modelBuilder.Entity<ApplicationUser>() .ToTable("Users") .Ignore(p => p.Logins) .Ignore(p => p.Claims) .HasMany(u => u.Roles) .WithRequired() .HasForeignKey(ur => ur.UserId); modelBuilder.Entity<IdentityRole>() .ToTable("Roles") .HasMany(u => u.Users) .WithRequired() .HasForeignKey(ur => ur.UserId); modelBuilder.Entity<IdentityUserRole>() .HasKey(r => new { r.UserId, r.RoleId }) .ToTable("UserRoles"); }
The navigation property 'Claims' is not a declared property on type 'ApplicationUser'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property.