Entity framework core 具有自定义配置DBContext的IdentityServer4

Entity framework core 具有自定义配置DBContext的IdentityServer4,entity-framework-core,dbcontext,identityserver4,Entity Framework Core,Dbcontext,Identityserver4,我可以自定义ConfigurationDBContext吗?我已经创建了一个,代码如下 public class MyConfigurationDbContext : ConfigurationDbContext { public MyConfigurationDbContext(DbContextOptions<ConfigurationDbContext> options, ConfigurationStoreOption

我可以自定义ConfigurationDBContext吗?我已经创建了一个,代码如下

public class MyConfigurationDbContext : ConfigurationDbContext
{    
        public MyConfigurationDbContext(DbContextOptions<ConfigurationDbContext> options, 
                ConfigurationStoreOptions storeOptions)
                : base(options, storeOptions)
        {                
        }
}
公共类MyConfigurationDbContext:ConfigurationDbContext
{    
公共MyConfigurationDbContext(DbContextOptions选项,
配置存储选项(存储选项)
:base(选项、存储选项)
{                
}
}
我注意到ConfigurationDBContext需要特殊的DbContextOptions

DbContextOptions<ConfigurationDbContext>
DbContextOptions

我现在有点困惑。在我继续之前,我想检查一下以前有人做过吗?或者,如果有人可以向项目或教程指出这一点。

中的
IConfigurationDbContext
的定义


MJK,这方面运气好吗?是的,我已经实现了,并在其中添加了两个实体。大多数情况下,我只是传递新初始化的对象。我可以分享您关于如何实现自定义ConfigurationDbContext的答案吗?我得到这个错误:“IdentityConfigurationDbContext”上找不到无参数构造函数。向“IdentityConfigurationDbContext”添加无参数构造函数,或在与“IdentityConfigurationDbContext”相同的程序集中添加“IDbContextFactory”的实现。在哪一点上,您会收到错误?为什么不用StackOverflow中的代码提问?如果你能在这里添加链接,我可以试试。干杯
public interface IConfigurationDbContext : IDisposable
{
    DbSet<Client> Clients { get; set; }
    DbSet<IdentityResource> IdentityResources { get; set; }
    DbSet<ApiResource> ApiResources { get; set; }

    int SaveChanges();
    Task<int> SaveChangesAsync();
}
public class IdentityConfigurationDbContextFactory : IDbContextFactory<MyConfigurationDbContext>
{
    public MyConfigurationDbContext Create(DbContextFactoryOptions options)
    {
        //....
    }
}