diff --git a/aspnet-core/Directory.Build.Volo.targets b/aspnet-core/Directory.Build.Volo.targets
index 0ccb7e9f..b8b6e199 100644
--- a/aspnet-core/Directory.Build.Volo.targets
+++ b/aspnet-core/Directory.Build.Volo.targets
@@ -1,93 +1,93 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/Directory.Build.targets b/aspnet-core/Directory.Build.targets
index d338319c..7e977376 100644
--- a/aspnet-core/Directory.Build.targets
+++ b/aspnet-core/Directory.Build.targets
@@ -22,43 +22,43 @@
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -69,25 +69,25 @@
+
+
-
-
-
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/Lion.AbpPro.All.sln b/aspnet-core/Lion.AbpPro.All.sln
index 66b78632..b214d9bf 100644
--- a/aspnet-core/Lion.AbpPro.All.sln
+++ b/aspnet-core/Lion.AbpPro.All.sln
@@ -398,6 +398,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.ElasticSearch.T
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.EntityFrameworkCore.Tests", "frameworks\test\Lion.AbpPro.EntityFrameworkCore.Mysql.Tests\Lion.AbpPro.EntityFrameworkCore.Tests.csproj", "{FFD342DF-87A5-4642-B694-58714C506883}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.Starter", "frameworks\src\Lion.AbpPro.Starter\Lion.AbpPro.Starter.csproj", "{187AEDA5-8323-45B4-90F6-A2F5574DEB25}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -948,6 +950,10 @@ Global
{FFD342DF-87A5-4642-B694-58714C506883}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFD342DF-87A5-4642-B694-58714C506883}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFD342DF-87A5-4642-B694-58714C506883}.Release|Any CPU.Build.0 = Release|Any CPU
+ {187AEDA5-8323-45B4-90F6-A2F5574DEB25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {187AEDA5-8323-45B4-90F6-A2F5574DEB25}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {187AEDA5-8323-45B4-90F6-A2F5574DEB25}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {187AEDA5-8323-45B4-90F6-A2F5574DEB25}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1128,6 +1134,7 @@ Global
{4E9F48F8-4EBB-4D47-BC10-35760EE4F645} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
{A9824877-9F0C-4E33-BEFC-1DD62A365C75} = {EFC415F8-872F-4C7E-8645-31A51481BCFC}
{FFD342DF-87A5-4642-B694-58714C506883} = {EFC415F8-872F-4C7E-8645-31A51481BCFC}
+ {187AEDA5-8323-45B4-90F6-A2F5574DEB25} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}
diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Core/Lion.AbpPro.Core.csproj b/aspnet-core/frameworks/src/Lion.AbpPro.Core/Lion.AbpPro.Core.csproj
index 361f69a5..97592ab8 100644
--- a/aspnet-core/frameworks/src/Lion.AbpPro.Core/Lion.AbpPro.Core.csproj
+++ b/aspnet-core/frameworks/src/Lion.AbpPro.Core/Lion.AbpPro.Core.csproj
@@ -6,10 +6,6 @@
-
-
-
-
diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj b/aspnet-core/frameworks/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj
index 4c758be2..39ea9456 100644
--- a/aspnet-core/frameworks/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj
+++ b/aspnet-core/frameworks/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj
@@ -5,6 +5,7 @@
enable
enable
+ CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;EF1001
diff --git a/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Lion.AbpPro.EntityFrameworkCore.Tests.csproj b/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Lion.AbpPro.EntityFrameworkCore.Tests.csproj
index 07b40449..f74f8333 100644
--- a/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Lion.AbpPro.EntityFrameworkCore.Tests.csproj
+++ b/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Lion.AbpPro.EntityFrameworkCore.Tests.csproj
@@ -8,9 +8,9 @@
CS8618;CS0162;CS1584
-
-
-
+
+
+
@@ -21,59 +21,59 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
+
diff --git a/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Services/BlogAppService.cs b/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Services/BlogAppService.cs
index cf6c8a09..b0b92542 100644
--- a/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Services/BlogAppService.cs
+++ b/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Services/BlogAppService.cs
@@ -1,134 +1,134 @@
-using System.Diagnostics;
-using Lion.AbpPro.EntityFrameworkCore.Tests.Blogs;
-using Lion.AbpPro.EntityFrameworkCore.Tests.Entities.Blogs;
-using Microsoft.EntityFrameworkCore;
-using Volo.Abp;
-using Volo.Abp.Application.Services;
-using Volo.Abp.Domain.Repositories;
-using Volo.Abp.Identity;
-using Volo.Abp.Uow;
-
-namespace Lion.AbpPro.EntityFrameworkCore.Tests.Services;
-
-public class BlogAppService : ApplicationService
-{
- private readonly IBlogRepository _blogRepository;
- private readonly IRepository _postRepository;
- private readonly IRepository _commentRepository;
- private readonly IdentityRoleManager _identityRoleManager;
-
- public BlogAppService(IBlogRepository blogRepository, IdentityRoleManager identityRoleManager, IRepository postRepository, IRepository commentRepository)
- {
- _blogRepository = blogRepository;
- _identityRoleManager = identityRoleManager;
- _postRepository = postRepository;
- _commentRepository = commentRepository;
- }
-
-
- ///
- /// 批量插入10000条数据
- ///
- public async Task CreateAsync(int qty = 10000)
- {
- // mock 数据
- var list = GenFu.GenFu.ListOf(qty);
- var stopwatch = new Stopwatch();
- stopwatch.Start();
- await _blogRepository.InsertManyAsync(list);
- stopwatch.Stop();
- Logger.LogInformation($"批量插入{list.Count}条,耗时(单位:毫秒):{stopwatch.ElapsedMilliseconds}");
- }
-
- ///
- /// 批量插入10000条数据
- ///
- public async Task CreateAllAsync(int qty = 10000)
- {
- // mock 数据
- var blogs = GenFu.GenFu.ListOf(qty);
- var posts = new List();
- var comments = new List();
- // blog和post一对多,post和comment一对多
- // 有主外键关系,所以循环mock数据
- foreach (var blog in blogs)
- {
- posts.Add(new Post(GuidGenerator.Create(), blog.Id, "name"));
- }
-
-
- foreach (var post in posts)
- {
- comments.Add(new Comment(GuidGenerator.Create(), 1, post.Id, "content"));
- }
-
- var stopwatch = new Stopwatch();
- stopwatch.Start();
- // 需要执行三次,不会因为ef有定义关系而一次性插入posts和comments
- await _blogRepository.InsertManyAsync(blogs);
- await _postRepository.InsertManyAsync(posts);
- await _commentRepository.InsertManyAsync(comments);
- stopwatch.Stop();
- Logger.LogInformation($"批量插入blogs:{blogs.Count},posts:{posts.Count},comments:{comments.Count}条,耗时(单位:毫秒):{stopwatch.ElapsedMilliseconds}");
- }
-
- ///
- /// 批量插入10000条数据,并且测试事务是否和其它业务逻辑保持一致
- /// 测试结果:在一个事务内
- ///
- public async Task CreateTransactionAsync(int qty = 10)
- {
- var list = GenFu.GenFu.ListOf(qty);
- var stopwatch = new Stopwatch();
- stopwatch.Start();
- await _blogRepository.InsertManyAsync(list);
- stopwatch.Stop();
- Logger.LogInformation($"批量插入{list.Count}条,耗时(单位:毫秒):{stopwatch.ElapsedMilliseconds}");
- await _identityRoleManager.CreateAsync(new IdentityRole(GuidGenerator.Create(), GuidGenerator.Create().ToString()));
- throw new UserFriendlyException("test");
- }
-
- ///
- /// 批量更新
- ///
- ///
- public async Task BatchUpdateAsync(int qty = 10000)
- {
- using (var uow = UnitOfWorkManager.Begin(new AbpUnitOfWorkOptions(true), true))
- {
- var list = GenFu.GenFu.ListOf(qty);
- await _blogRepository.InsertManyAsync(list);
- await uow.CompleteAsync();
- }
-
- var stopwatch = new Stopwatch();
- stopwatch.Start();
- var dbSet = await _blogRepository.GetDbSetAsync();
- await dbSet.ExecuteUpdateAsync(setters => setters
- .SetProperty(x => x.IsDeleted, x => true)
- .SetProperty(x => x.Name, x => "test"));
- stopwatch.Stop();
- Logger.LogInformation($"批量更新{qty}条,耗时(单位:毫秒):{stopwatch.ElapsedMilliseconds}");
- }
-
- ///
- /// 批量删除
- ///
- ///
- public async Task BatchDeleteAsync(int qty = 10000)
- {
- using (var uow = UnitOfWorkManager.Begin(new AbpUnitOfWorkOptions(true), true))
- {
- var list = GenFu.GenFu.ListOf(qty);
- await _blogRepository.InsertManyAsync(list);
- await uow.CompleteAsync();
- }
-
- var stopwatch = new Stopwatch();
- stopwatch.Start();
- var dbSet = await _blogRepository.GetDbSetAsync();
- await dbSet.ExecuteDeleteAsync();
- stopwatch.Stop();
- Logger.LogInformation($"批量删除{qty}条,耗时(单位:毫秒):{stopwatch.ElapsedMilliseconds}");
- }
-}
\ No newline at end of file
+// using System.Diagnostics;
+// using Lion.AbpPro.EntityFrameworkCore.Tests.Blogs;
+// using Lion.AbpPro.EntityFrameworkCore.Tests.Entities.Blogs;
+// using Microsoft.EntityFrameworkCore;
+// using Volo.Abp;
+// using Volo.Abp.Application.Services;
+// using Volo.Abp.Domain.Repositories;
+// using Volo.Abp.Identity;
+// using Volo.Abp.Uow;
+//
+// namespace Lion.AbpPro.EntityFrameworkCore.Tests.Services;
+//
+// public class BlogAppService : ApplicationService
+// {
+// private readonly IBlogRepository _blogRepository;
+// private readonly IRepository _postRepository;
+// private readonly IRepository _commentRepository;
+// private readonly IdentityRoleManager _identityRoleManager;
+//
+// public BlogAppService(IBlogRepository blogRepository, IdentityRoleManager identityRoleManager, IRepository postRepository, IRepository commentRepository)
+// {
+// _blogRepository = blogRepository;
+// _identityRoleManager = identityRoleManager;
+// _postRepository = postRepository;
+// _commentRepository = commentRepository;
+// }
+//
+//
+// ///
+// /// 批量插入10000条数据
+// ///
+// public async Task CreateAsync(int qty = 10000)
+// {
+// // mock 数据
+// var list = GenFu.GenFu.ListOf(qty);
+// var stopwatch = new Stopwatch();
+// stopwatch.Start();
+// await _blogRepository.InsertManyAsync(list);
+// stopwatch.Stop();
+// Logger.LogInformation($"批量插入{list.Count}条,耗时(单位:毫秒):{stopwatch.ElapsedMilliseconds}");
+// }
+//
+// ///
+// /// 批量插入10000条数据
+// ///
+// public async Task CreateAllAsync(int qty = 10000)
+// {
+// // mock 数据
+// var blogs = GenFu.GenFu.ListOf(qty);
+// var posts = new List();
+// var comments = new List();
+// // blog和post一对多,post和comment一对多
+// // 有主外键关系,所以循环mock数据
+// foreach (var blog in blogs)
+// {
+// posts.Add(new Post(GuidGenerator.Create(), blog.Id, "name"));
+// }
+//
+//
+// foreach (var post in posts)
+// {
+// comments.Add(new Comment(GuidGenerator.Create(), 1, post.Id, "content"));
+// }
+//
+// var stopwatch = new Stopwatch();
+// stopwatch.Start();
+// // 需要执行三次,不会因为ef有定义关系而一次性插入posts和comments
+// await _blogRepository.InsertManyAsync(blogs);
+// await _postRepository.InsertManyAsync(posts);
+// await _commentRepository.InsertManyAsync(comments);
+// stopwatch.Stop();
+// Logger.LogInformation($"批量插入blogs:{blogs.Count},posts:{posts.Count},comments:{comments.Count}条,耗时(单位:毫秒):{stopwatch.ElapsedMilliseconds}");
+// }
+//
+// ///
+// /// 批量插入10000条数据,并且测试事务是否和其它业务逻辑保持一致
+// /// 测试结果:在一个事务内
+// ///
+// public async Task CreateTransactionAsync(int qty = 10)
+// {
+// var list = GenFu.GenFu.ListOf(qty);
+// var stopwatch = new Stopwatch();
+// stopwatch.Start();
+// await _blogRepository.InsertManyAsync(list);
+// stopwatch.Stop();
+// Logger.LogInformation($"批量插入{list.Count}条,耗时(单位:毫秒):{stopwatch.ElapsedMilliseconds}");
+// await _identityRoleManager.CreateAsync(new IdentityRole(GuidGenerator.Create(), GuidGenerator.Create().ToString()));
+// throw new UserFriendlyException("test");
+// }
+//
+// ///
+// /// 批量更新
+// ///
+// ///
+// public async Task BatchUpdateAsync(int qty = 10000)
+// {
+// using (var uow = UnitOfWorkManager.Begin(new AbpUnitOfWorkOptions(true), true))
+// {
+// var list = GenFu.GenFu.ListOf(qty);
+// await _blogRepository.InsertManyAsync(list);
+// await uow.CompleteAsync();
+// }
+//
+// var stopwatch = new Stopwatch();
+// stopwatch.Start();
+// var dbSet = await _blogRepository.GetDbSetAsync();
+// await dbSet.ExecuteUpdateAsync(setters => setters
+// .SetProperty(x => x.IsDeleted, x => true)
+// .SetProperty(x => x.Name, x => "test"));
+// stopwatch.Stop();
+// Logger.LogInformation($"批量更新{qty}条,耗时(单位:毫秒):{stopwatch.ElapsedMilliseconds}");
+// }
+//
+// ///
+// /// 批量删除
+// ///
+// ///
+// public async Task BatchDeleteAsync(int qty = 10000)
+// {
+// using (var uow = UnitOfWorkManager.Begin(new AbpUnitOfWorkOptions(true), true))
+// {
+// var list = GenFu.GenFu.ListOf(qty);
+// await _blogRepository.InsertManyAsync(list);
+// await uow.CompleteAsync();
+// }
+//
+// var stopwatch = new Stopwatch();
+// stopwatch.Start();
+// var dbSet = await _blogRepository.GetDbSetAsync();
+// await dbSet.ExecuteDeleteAsync();
+// stopwatch.Stop();
+// Logger.LogInformation($"批量删除{qty}条,耗时(单位:毫秒):{stopwatch.ElapsedMilliseconds}");
+// }
+// }
\ No newline at end of file
diff --git a/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/Lion.AbpPro.BasicManagement.HttpApi.Host.csproj b/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/Lion.AbpPro.BasicManagement.HttpApi.Host.csproj
index 3911b079..4d163135 100644
--- a/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/Lion.AbpPro.BasicManagement.HttpApi.Host.csproj
+++ b/aspnet-core/modules/BasicManagement/host/Lion.AbpPro.BasicManagement.HttpApi.Host/Lion.AbpPro.BasicManagement.HttpApi.Host.csproj
@@ -10,7 +10,6 @@
-
diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Lion.AbpPro.BasicManagement.Application.csproj b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Lion.AbpPro.BasicManagement.Application.csproj
index 9f4d46e8..7d3ce82d 100644
--- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Lion.AbpPro.BasicManagement.Application.csproj
+++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Lion.AbpPro.BasicManagement.Application.csproj
@@ -16,9 +16,9 @@
-
-
-
+
+
+
diff --git a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj
index ec3c0c71..ce03cd9e 100644
--- a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj
+++ b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/Lion.AbpPro.FileManagement.HttpApi.Host.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj
index 496755b5..2e2e91d3 100644
--- a/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj
+++ b/aspnet-core/modules/NotificationManagement/host/Lion.AbpPro.NotificationManagement.HttpApi.Host/Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj
@@ -18,7 +18,6 @@
-
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.Configure.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.Configure.cs
index 789cf38c..8eca0b04 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.Configure.cs
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.Configure.cs
@@ -112,7 +112,7 @@ public partial class AbpProHttpApiHostModule
Configure(
options => { options.KeyPrefix = "AbpPro:"; });
var configuration = context.Services.GetConfiguration();
- var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
+ var redis = ConnectionMultiplexer.Connect(configuration.GetValue("Redis:Configuration"));
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys");
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs
index 0b60928f..93676afe 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Extensions/Hangfire/RecurringJobsExtensions.cs
@@ -6,7 +6,10 @@ namespace Lion.AbpPro.Extensions.Hangfire
{
public static void CreateRecurringJob(this ApplicationInitializationContext context)
{
- RecurringJob.AddOrUpdate("测试Job", t => t.ExecuteAsync(), CronType.Minute(1),TimeZoneInfo.Local);
+ RecurringJob.AddOrUpdate("测试Job", e => e.ExecuteAsync(), CronType.Minute(1), new RecurringJobOptions()
+ {
+ TimeZone = TimeZoneInfo.Local
+ });
}
}
}
\ No newline at end of file
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs
index 6c50ca58..06788808 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/GlobalUsings.cs
@@ -11,6 +11,7 @@ global using Hangfire;
global using Hangfire.Common;
global using Hangfire.Dashboard;
global using Hangfire.Redis;
+global using Hangfire.Redis.StackExchange;
global using Hangfire.States;
global using Hangfire.Storage;
global using Lion.AbpPro.CAP;
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj
index cf871f7c..e7314fa1 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj
@@ -9,7 +9,6 @@
-
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Startup.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Startup.cs
index e0a3a841..c8e3847f 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Startup.cs
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Startup.cs
@@ -25,6 +25,7 @@ namespace Lion.AbpPro
///
/// 程序首次访问接口速度慢,事先预热
///
+ [Obsolete("请使用Lion.AbpPro.Starter模块,实现IAbpProStarterContributor")]
private void ConfigurePreheat()
{
var url = _configuration.GetValue("App:SelfUrl");
diff --git a/aspnet-core/services/src/Lion.AbpPro.FreeSqlRepository/Lion.AbpPro.FreeSqlRepository.csproj b/aspnet-core/services/src/Lion.AbpPro.FreeSqlRepository/Lion.AbpPro.FreeSqlRepository.csproj
index 508ae217..17db6032 100644
--- a/aspnet-core/services/src/Lion.AbpPro.FreeSqlRepository/Lion.AbpPro.FreeSqlRepository.csproj
+++ b/aspnet-core/services/src/Lion.AbpPro.FreeSqlRepository/Lion.AbpPro.FreeSqlRepository.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/GlobalUsings.cs b/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/GlobalUsings.cs
index 5bcfd1d7..d83618ba 100644
--- a/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/GlobalUsings.cs
+++ b/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/GlobalUsings.cs
@@ -9,7 +9,9 @@ global using System.Reflection;
global using System.Text;
global using System.Text.RegularExpressions;
global using Consul;
+global using Lion.AbpPro;
global using Lion.AbpPro.Core;
+global using Lion.AbpPro.Localization;
global using Microsoft.AspNetCore.Builder;
global using Microsoft.AspNetCore.Cors;
global using Microsoft.AspNetCore.Http;
@@ -18,9 +20,11 @@ global using Microsoft.AspNetCore.Mvc;
global using Microsoft.AspNetCore.Mvc.Abstractions;
global using Microsoft.AspNetCore.Mvc.ApiExplorer;
global using Microsoft.AspNetCore.Mvc.Filters;
+global using Microsoft.EntityFrameworkCore;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Hosting;
+global using Microsoft.Extensions.Localization;
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Logging.Abstractions;
global using Microsoft.Extensions.Options;
@@ -36,6 +40,7 @@ global using Volo.Abp;
global using Volo.Abp.AspNetCore.ExceptionHandling;
global using Volo.Abp.AspNetCore.Mvc;
global using Volo.Abp.AspNetCore.Mvc.AntiForgery;
+global using Volo.Abp.AspNetCore.Mvc.ExceptionHandling;
global using Volo.Abp.Authorization;
global using Volo.Abp.Autofac;
global using Volo.Abp.DependencyInjection;
@@ -44,6 +49,7 @@ global using Volo.Abp.ExceptionHandling;
global using Volo.Abp.Http;
global using Volo.Abp.Json;
global using Volo.Abp.Localization;
+global using Volo.Abp.Localization.ExceptionHandling;
global using Volo.Abp.Modularity;
global using Volo.Abp.Swashbuckle;
global using Volo.Abp.UI.Navigation.Urls;
diff --git a/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/Microsoft/AspNetCore/Mvc/Filters/AbpProExceptionFilter.cs b/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/Microsoft/AspNetCore/Mvc/Filters/AbpProExceptionFilter.cs
index bcbff1ff..119cc1dd 100644
--- a/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/Microsoft/AspNetCore/Mvc/Filters/AbpProExceptionFilter.cs
+++ b/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/Microsoft/AspNetCore/Mvc/Filters/AbpProExceptionFilter.cs
@@ -1,40 +1,53 @@
-using System.Text;
-using Lion.AbpPro;
-using Lion.AbpPro.Localization;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Localization;
-using Volo.Abp.Localization.ExceptionHandling;
-
namespace Microsoft.AspNetCore.Mvc.Filters;
-public sealed class AbpProExceptionFilter : IAsyncExceptionFilter, ITransientDependency
+[Dependency(ReplaceServices = true)]
+[ExposeServices(typeof(AbpExceptionFilter))]
+public class AbpProExceptionFilter : AbpExceptionFilter
{
- public async Task OnExceptionAsync(ExceptionContext context)
+ protected override bool ShouldHandleException(ExceptionContext context)
{
- if (!ShouldHandleException(context))
- {
- return;
- }
+ return IsWrapResult(context) || base.ShouldHandleException(context);
+ }
- await HandleAndWrapException(context);
+ protected override async Task HandleAndWrapException(ExceptionContext context)
+ {
+ LoggerException(context);
+ if (WrapResultHandler(context)) return;
+ await DefaultHandlerAsync(context);
}
- private bool ShouldHandleException(ExceptionContext context)
+ private void LoggerException(ExceptionContext context)
{
- if (context.ActionDescriptor.AsControllerActionDescriptor().ControllerTypeInfo.GetCustomAttributes(typeof(WrapResultAttribute), true).Any())
+ var exceptionHandlingOptions = context.GetRequiredService>().Value;
+ var exceptionToErrorInfoConverter = context.GetRequiredService();
+ var remoteServiceErrorInfo = exceptionToErrorInfoConverter.Convert(context.Exception, options =>
{
- return true;
- }
+ options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients;
+ options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients;
+ });
- if (context.ActionDescriptor.GetMethodInfo().GetCustomAttributes(typeof(WrapResultAttribute), true).Any())
- {
- return true;
- }
+ var logger = context.GetService>(NullLogger.Instance)!;
+ var logLevel = context.Exception.GetLogLevel();
+ logger.LogException(context.Exception, logLevel);
+ }
- return false;
+ ///
+ /// webapi有WrapResult特性标签处理逻辑
+ ///
+ private bool WrapResultHandler(ExceptionContext context)
+ {
+ if (!IsWrapResult(context)) return false;
+
+ context.HttpContext.Response.StatusCode = 200;
+ var result = SimplifyMessage(context);
+ context.Result = new ObjectResult(result);
+ return true;
}
- private async Task HandleAndWrapException(ExceptionContext context)
+ ///
+ /// 默认异常处理逻辑
+ ///
+ private async Task DefaultHandlerAsync(ExceptionContext context)
{
var exceptionHandlingOptions = context.GetRequiredService>().Value;
var exceptionToErrorInfoConverter = context.GetRequiredService();
@@ -44,23 +57,34 @@ public sealed class AbpProExceptionFilter : IAsyncExceptionFilter, ITransientDep
options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients;
});
- var logLevel = context.Exception.GetLogLevel();
-
- var remoteServiceErrorInfoBuilder = new StringBuilder();
- remoteServiceErrorInfoBuilder.AppendLine($"---------- {nameof(RemoteServiceErrorInfo)} ----------");
- remoteServiceErrorInfoBuilder.AppendLine(context.GetRequiredService().Serialize(remoteServiceErrorInfo, indented: true));
-
- var logger = context.GetService>(NullLogger.Instance);
+ if (context.Exception is AbpAuthorizationException)
+ {
+ await context.HttpContext.RequestServices.GetRequiredService()
+ .HandleAsync(context.Exception.As(), context.HttpContext);
+ }
+ else
+ {
+ context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true");
+ context.HttpContext.Response.StatusCode = (int)context
+ .GetRequiredService()
+ .GetStatusCode(context.HttpContext, context.Exception);
+ context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo));
+ }
+ }
- logger.LogWithLevel(logLevel, remoteServiceErrorInfoBuilder.ToString());
+ private bool IsWrapResult(ExceptionContext context)
+ {
+ if (context.ActionDescriptor.AsControllerActionDescriptor().ControllerTypeInfo.GetCustomAttributes(typeof(WrapResultAttribute), true).Any())
+ {
+ return true;
+ }
- logger.LogException(context.Exception, logLevel);
+ if (context.ActionDescriptor.GetMethodInfo().GetCustomAttributes(typeof(WrapResultAttribute), true).Any())
+ {
+ return true;
+ }
- await context.GetRequiredService().NotifyAsync(new ExceptionNotificationContext(context.Exception));
- context.HttpContext.Response.StatusCode = 200;
- var result = SimplifyMessage(context);
- context.Result = new ObjectResult(result);
- context.Exception = null; //Handled!
+ return false;
}
private WrapResult