After deleting migration folder and database from ssms I got this error when running add-migration command.
This is my ApplicationDatabaseContext :
public class ApplicationDatabaseContext : IdentityDbContext
{
public ApplicationDatabaseContext(DbContextOptions<ApplicationDatabaseContext> options) : base(options)
{
}
public DbSet<CommentGroup> CommentGroup { get; set; }
public DbSet<Review> Reviews { get; set; }
public DbSet<Comment> Comments { get; set; }
public DbSet<Websites> Websites { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<IdentityUser>(entity =>
{
entity.ToTable(name: "User");
});
builder.Entity<IdentityRole>(entity =>
{
entity.ToTable(name: "Role");
});
builder.Entity<IdentityUserRole<string>>(entity =>
{
entity.ToTable("UserRoles");
});
builder.Entity<IdentityUserClaim<string>>(entity =>
{
entity.ToTable("UserClaims");
});
builder.Entity<IdentityUserLogin<string>>(entity =>
{
entity.ToTable("UserLogins");
});
builder.Entity<IdentityRoleClaim<string>>(entity =>
{
entity.ToTable("RoleClaims");
});
builder.Entity<IdentityUserToken<string>>(entity =>
{
entity.ToTable("UserTokens");
});
}
}
I just deleted the migration folder and database from ssms and run add-migration command.
CodePudding user response:
The problem solved by adding a empty constructor in AplicationDatabaseContext.cs.