Closed yhmodem closed 3 years ago
我看了这个就是EF原始的DbContext方式,通过重写OnModelCreating完成。
但我写了MyDbContext来重写如何使用到EF.Sharding中呢?
ConfigureServices方法中吗?
services.UseEFCoreSharding(config =>
{
string conName = Configuration["ConnectionName"];
if (Configuration["LogicDelete"].ToBool())
config.UseLogicDelete();
config.UseDatabase(Configuration.GetConnectionString(conName), Configuration["DatabaseType"].ToEnum
});
services.AddDbContext《MyDbContext》();
这样好像不行。
联合主键如何设置。现在报:Entity type 'SYS_MAIN_TREE' has composite primary key defined with data annotations. To set composite primary key, use fluent API.