I have a ConfigurationDbContext
that I am trying to use. It has multiple parameters, DbContextOptions
and ConfigurationStoreOptions
.
How can I add this DbContext to my services in ASP.NET Core?
I have attempted the following in my Startup.cs:
ConfigureServices
....
services.AddDbContext<ConfigurationDbContext>(BuildDbContext(connString));
....
private ConfigurationDbContext BuildDbContext(string connString)
{
var builder = new DbContextOptionsBuilder<ConfigurationDbContext>();
builder.UseSqlServer(connString);
var options = builder.Options;
return new ConfigurationDbContext(options, new ConfigurationStoreOptions());
}