I need to create a database in ASP.NET Core and use identity, and I need to use UseInMemoryDatabase but when I try to add a migration, I get this error:
Unable to create an object of type 'DortajContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
This is my start up:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContextPool<DortajContext>(options => options.UseInMemoryDatabase(databaseName: "DortajDistance"));
services.AddIdentity<IdentityUser, IdentityRole>().AddEntityFrameworkStores<DortajContext>();
services.AddControllers();
}
and this is my context :
public class DortajContext : IdentityDbContext<User, Role, int>
{
public DortajContext(DbContextOptions<DortajContext> options)
: base(options)
{
}
public DbSet<UserDistanceHistory> UserDistanceHistories { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ApplyConfigurationsFromAssembly(typeof(IType).Assembly);
}
}
How can I solve this problem?