优化一个bug

This commit is contained in:
xuejiaming 2021-10-22 17:52:02 +08:00
parent 3963d3bd0f
commit f45f76e4e5
2 changed files with 7 additions and 6 deletions

View File

@ -1,8 +1,8 @@
:start
::定义版本
set EFCORE2=2.3.1.06
set EFCORE3=3.3.1.06
set EFCORE5=5.3.1.06
set EFCORE2=2.3.1.07
set EFCORE3=3.3.1.07
set EFCORE5=5.3.1.07
::删除所有bin与obj下的文件
@echo off

View File

@ -14,10 +14,11 @@ using Volo.Abp.EntityFrameworkCore;
namespace Samples.AbpSharding
{
public abstract class AbstractShardingAbpDbContext : AbpDbContext<AbstractShardingAbpDbContext>, IShardingDbContext, ISupportShardingTransaction, ISupportShardingReadWrite
public abstract class AbstractShardingAbpDbContext<TDbContext> : AbpDbContext<TDbContext>, IShardingDbContext, ISupportShardingTransaction, ISupportShardingReadWrite
where TDbContext:DbContext
{
private readonly IShardingDbContextExecutor _shardingDbContextExecutor;
protected AbstractShardingAbpDbContext(DbContextOptions<AbstractShardingAbpDbContext> options) : base(options)
protected AbstractShardingAbpDbContext(DbContextOptions<TDbContext> options) : base(options)
{
var wrapOptionsExtension = options.FindExtension<ShardingWrapOptionsExtension>();
@ -60,7 +61,7 @@ namespace Samples.AbpSharding
public DbContext GetDbContext(string dataSourceName, bool parallelQuery, IRouteTail routeTail)
{
var dbContext = _shardingDbContextExecutor.CreateDbContext(parallelQuery, dataSourceName, routeTail);
if (!parallelQuery&& dbContext is AbstractShardingAbpDbContext abstractShardingAbpDbContext)
if (!parallelQuery&& dbContext is AbstractShardingAbpDbContext<TDbContext> abstractShardingAbpDbContext)
{
abstractShardingAbpDbContext.LazyServiceProvider = this.LazyServiceProvider;
}