优化无iserviceprovider的初始化
This commit is contained in:
parent
b5aa66f37a
commit
eab96611fa
|
@ -103,6 +103,10 @@ namespace ShardingCore
|
|||
DbContextOptionsBuilder dbContextOptionsBuilder) where TShardingDbContext : DbContext, IShardingDbContext
|
||||
{
|
||||
var shardingRuntimeContext = serviceProvider.GetRequiredService<IShardingRuntimeContext>();
|
||||
dbContextOptionsBuilder.UseDefaultSharding<TShardingDbContext>(shardingRuntimeContext);
|
||||
}
|
||||
public static void UseDefaultSharding<TShardingDbContext>(this DbContextOptionsBuilder dbContextOptionsBuilder,IShardingRuntimeContext shardingRuntimeContext) where TShardingDbContext : DbContext, IShardingDbContext
|
||||
{
|
||||
var shardingConfigOptions = shardingRuntimeContext.GetShardingConfigOptions();
|
||||
shardingConfigOptions.ShardingMigrationConfigure?.Invoke(dbContextOptionsBuilder);
|
||||
var virtualDataSource = shardingRuntimeContext.GetVirtualDataSource();
|
||||
|
|
Loading…
Reference in New Issue