I am working on an ASP.NET core project with several DbContexts, one of them is a Identity Context.
I applied Tao Zhou's (Aspnet core Identity custom ApiAuthorizationDbContext) solution to a problem and this solved my problem first, but now I have the problem that I can't create an ApplicationDbContext without parameters.
- DbContextOptions options
- IOptions operationalStoreOptions
Here are a few coding lines to illustrate it
I have in the Startup the ApplicationDbContext registered
Startup
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("IdentityConnection"))
);
ApplicationDbContext
public class ApplicationDbContext : KeyApiAuthorizationDbContext<Identity.AspNetUsers, Identity.AspNetRoles, Guid>
public ApplicationDbContext(DbContextOptions options,
IOptions<OperationalStoreOptions> operationalStoreOptions) : base(options, operationalStoreOptions)
{
}
If I want to create a new
ApplicationDbContext ctx = new ApplicationDbContext();
I need these two parameters...
It'd be great if someone could give me a hint.
Thank you and Best Regards, Noel