пытаюсь сделать миграцию в RIDER, но постоянно выходит ошибка с миграцией, в чем именно проблема?
Миграцию делаю
dotnet-ef migrations add LibralyReact
ошибка :Unable to create an object of type 'ApplicationContext'. For the different patterns supported at design time, see
https://go.microsoft.com/fwlink/?linkid=851728
User:
public class User:IdentityUser
{
public string Password { get; set; }
public string FirstName { get; set; }
public string Surname { get; set; }
}
Application
public sealed class ApplicationContext:IdentityDbContext<User>
{
public ApplicationContext(DbContextOptions<ApplicationContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
builder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
base.OnModelCreating(builder);
}
}
добавление в сервис
public static IServiceCollection InitServices(IServiceCollection services, IConfiguration configuration)
{
services.AddDbContext<ApplicationContext>(
options => options.UseNpgsql(configuration.GetConnectionString("DefaultConnection"),
b => b.MigrationsAssembly("Libraly.Data")
));
services.AddIdentity<User, IdentityRole>().AddRoles<IdentityRole>()
.AddEntityFrameworkStores<ApplicationContext>();
services.AddSingleton(typeof(IUnitOfWork<>), typeof(IUnitOfWork<>));
return services;
}
и startup
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
//настройка сервисов
ConfigService.InitServices(services, Configuration);
services.AddControllersWithViews();
services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/build"; });
}