protectedなコンストラクタを定義する。
public class BaseDbContext : DbContext {
public BaseDbContext(DbContextOptions<BaseDbContext> options)
: base(options) {
}
protected BaseDbContext(DbContextOptions options)
: base(options) {
}
}
継承元のBaseDbContextから派生する。
public class DelivedDbContext : BaseDbContext {
public DelivedDbContext (DbContextOptions<DelivedDbContext> options)
: base(options) {
}
}
baseでは、protectedなコンストラクタが呼ばれる。
参考:
https://github.com/dotnet/efcore/issues/7533#issuecomment-353669263