更新时间:2023-02-14 21:09:56
您必须删除默认构造函数。换句话说,参数较少的构造函数。之后所有这些都将按预期工作。
You have to remove the default constructor.In other words parameter less constructor.After that all will work as expected.
注意:在运行时调用参数较少的构造方法,而不是此 public MyDbContext(DbContextOptions options):base(options){}
。
Note : The reason for that is, the parameter less constructor is being called at run time instead of this public MyDbContext(DbContextOptions options) : base(options) {}
.