Skip to content

Commit c80d05f

Browse files
committed
逻辑删除异常修复
1 parent 2a12542 commit c80d05f

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/Coldairarrow.Util/01.Coldairarrow.Util.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<PackageReference Include="AutoMapper" Version="9.0.0" />
3333
<PackageReference Include="Caching.CSRedis" Version="3.6.2" />
3434
<PackageReference Include="CSRedisCore" Version="3.6.2" />
35-
<PackageReference Include="EFCore.Sharding" Version="3.1.3.36" />
35+
<PackageReference Include="EFCore.Sharding" Version="3.1.3.39" />
3636
<PackageReference Include="EFCore.Sharding.SqlServer" Version="3.1.3" />
3737
<PackageReference Include="IdHelper.Zookeeper" Version="1.5.1" />
3838
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />

src/Coldairarrow.Util/AOP/TransactionalAttribute.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ public TransactionContainer(IServiceProvider serviceProvider)
4545
{
4646
_distributedTransaction = DistributedTransactionFactory.GetDistributedTransaction();
4747

48-
var repositories = GlobalData.AllFxTypes.Where(x =>
49-
typeof(IRepository).IsAssignableFrom(x)
50-
&& x.IsInterface
51-
).Select(x => serviceProvider.GetService(x) as IRepository)
48+
var allRepositoryInterfaces = GlobalData.AllFxTypes.Where(x =>
49+
typeof(IRepository).IsAssignableFrom(x)
50+
&& x.IsInterface
51+
&& x != typeof(IRepository)
52+
).ToList();
53+
allRepositoryInterfaces.Add(typeof(IRepository));
54+
55+
var repositories = allRepositoryInterfaces
56+
.Select(x => serviceProvider.GetService(x) as IRepository)
5257
.ToArray();
5358

5459
_distributedTransaction.AddRepository(repositories);

src/Coldairarrow.Util/GlobalData.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using EFCore.Sharding;
2-
using System;
1+
using System;
32
using System.Collections.Generic;
43
using System.IO;
54
using System.Linq;
@@ -45,8 +44,6 @@ public static List<Type> AllFxTypes
4544

4645
}
4746
});
48-
49-
_allFxTypes.Add(typeof(IRepository));
5047
}
5148
}
5249
}

0 commit comments

Comments
 (0)