I'm trying to put Asp.net identity context to a class library that provides data access using entity framework edmx.
But it gives an error such; The entity type ApplicationUser is not part of the model for the current context.
Here is db context class;
- public class ApplicationUser : IdentityUser
- {
- public async Task
GenerateUserIdentityAsync(UserManager 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;
- }
- }
- public partial class AppDbContext : IdentityDbContext
- {
- public AppDbContext ()
- : base("name=AppDbContext")
- {
- }
- public static AppDbContext Create()
- {
- return new AppDbContext();
- }
- protected override void OnModelCreating(DbModelBuilder modelBuilder)
- {
- throw new UnintentionalCodeFirstException();
- }
- //public virtual DbSet
AspNetRoles { get; set; } - //public virtual DbSet
AspNetUserClaims { get; set; } - //public virtual DbSet
AspNetUserLogins { get; set; } - //public virtual DbSet
AspNetUsers { get; set; } - }
Mukil VendhanPosted Sep 14, 2017, 10:18 AM
should be