Skip to content

Commit 2c420e0

Browse files
committed
挂起#187
1 parent 849adef commit 2c420e0

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

samples/web/Liuliu.Demo.WebApi/Liuliu.Demo.WebApi.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="AspectCore.Extensions.Hosting" Version="2.2.0" />
2726
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.11.1" />
2827
</ItemGroup>
2928
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
29+
<PackageReference Include="AspectCore.Extensions.Hosting" Version="2.2.0" />
3030
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="[3.1.21,4.0.0)" />
3131
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="[3.1.21,4.0.0)">
3232
<PrivateAssets>all</PrivateAssets>
@@ -35,6 +35,7 @@
3535
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="[3.1.5,4.0.0)" />
3636
</ItemGroup>
3737
<ItemGroup Condition="'$(TargetFramework)'=='net5.0'">
38+
<PackageReference Include="AspectCore.Extensions.Hosting" Version="2.2.0" />
3839
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.10" />
3940
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
4041
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.10">

src/OSharp/Entity/DynamicProxy/ITransactionDecision.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// <last-editor>郭明锋</last-editor>
77
// <last-date>2020-09-07 20:37</last-date>
88
// -----------------------------------------------------------------------
9+
#if !NET6_0
910

1011
using System;
1112

@@ -31,4 +32,5 @@ public interface ITransactionDecision : ISingletonDependency
3132
/// </returns>
3233
bool CanCommit(object returnResult);
3334
}
34-
}
35+
}
36+
#endif

src/OSharp/Entity/DynamicProxy/OperationResultTransactionDecision.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// <last-editor>郭明锋</last-editor>
77
// <last-date>2020-09-07 21:58</last-date>
88
// -----------------------------------------------------------------------
9+
#if !NET6_0
910

1011
using System;
1112
using System.Linq;
@@ -65,7 +66,8 @@ public bool CanCommit(object returnResult)
6566
}
6667

6768

68-
throw new NotImplementedException();
69+
throw new NotSupportedException($"{returnResult.GetType()}不是 OperationResultTransactionDecision 支持的返回类型");
6970
}
7071
}
71-
}
72+
}
73+
#endif

src/OSharp/Entity/DynamicProxy/TransactionalAttribute.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// <last-editor>郭明锋</last-editor>
77
// <last-date>2020-09-07 22:01</last-date>
88
// -----------------------------------------------------------------------
9-
9+
#if !NET6_0
1010
using System;
1111
using System.Linq;
1212
using System.Threading.Tasks;
@@ -50,8 +50,7 @@ public override async Task Invoke(AspectContext context, AspectDelegate next)
5050
return;
5151
}
5252
Type returnType = context.ProxyMethod.ReturnType;
53-
ITransactionDecision decision = provider.GetServices<ITransactionDecision>()
54-
.FirstOrDefault(m => m.IsFit(returnType));
53+
ITransactionDecision decision = provider.GetServices<ITransactionDecision>().FirstOrDefault(m => m.IsFit(returnType));
5554
if (decision == null)
5655
{
5756
throw new OsharpException($"无法找到与结果类型 {returnType} 匹配的 {typeof(ITransactionDecision)} 事务裁决器,请继承接口实现一个");
@@ -76,4 +75,6 @@ public override async Task Invoke(AspectContext context, AspectDelegate next)
7675
}
7776
}
7877
}
79-
}
78+
}
79+
80+
#endif

src/OSharp/OSharp.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<Import Project="../../build/public.props" />
44
<Import Project="../../build/version.props" />
@@ -14,7 +14,6 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="AspectCore.Extensions.DependencyInjection" Version="2.2.0" />
1817
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" />
1918
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
2019
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
@@ -29,6 +28,7 @@
2928
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
3029
</ItemGroup>
3130
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
31+
<PackageReference Include="AspectCore.Extensions.DependencyInjection" Version="2.2.0" />
3232
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="[3.1.21,4.0.0)" />
3333
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="[3.1.21,4.0.0)" />
3434
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="[3.1.21,4.0.0)" />
@@ -40,6 +40,7 @@
4040
<PackageReference Include="Microsoft.Extensions.Logging" Version="[3.1.21,4.0.0)" />
4141
</ItemGroup>
4242
<ItemGroup Condition="'$(TargetFramework)'=='net5.0'">
43+
<PackageReference Include="AspectCore.Extensions.DependencyInjection" Version="2.2.0" />
4344
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="[5.0.0, 6.0.0)" />
4445
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="[5.0.0, 6.0.0)" />
4546
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="[5.0.0, 6.0.0)" />

0 commit comments

Comments
 (0)