Browse Source

feat: 升级abp10

main-10.0.0
wangjunzzz 3 months ago
parent
commit
be9eb7615d
  1. 2
      aspnet-core/Directory.Build.targets
  2. 21
      aspnet-core/Lion.AbpPro.sln
  3. 12
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreConsts.cs
  4. 2
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs
  5. 9
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/Options/AbpProAntiForgeryOptions.cs
  6. 9
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/Options/AbpProCookieOptions.cs
  7. 16
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs
  8. 52
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Swagger/CachingSwaggerProvider.cs
  9. 42
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Swagger/EnumSchemaFilter.cs
  10. 96
      aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Swagger/HiddenAbpDefaultApiFilter.cs
  11. 12
      aspnet-core/frameworks/src/Lion.AbpPro.FreeSqlRepository/AbpProFreeSqlModule.cs
  12. 0
      aspnet-core/frameworks/src/Lion.AbpPro.FreeSqlRepository/FreeSqlBasicRepository.cs
  13. 0
      aspnet-core/frameworks/src/Lion.AbpPro.FreeSqlRepository/GlobalUsings.cs
  14. 2
      aspnet-core/frameworks/src/Lion.AbpPro.FreeSqlRepository/Lion.AbpPro.FreeSqlRepository.csproj
  15. 5
      aspnet-core/modules/LanguageManagement/src/Lion.AbpPro.LanguageManagement.Domain/DatabaseLanguageProvider.cs
  16. 2
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj
  17. 67
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Development.json
  18. 61
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json
  19. 65
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
  20. 5
      aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj
  21. 3
      aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationModule.cs
  22. 1
      aspnet-core/services/src/Lion.AbpPro.Application/GlobalUsings.cs
  23. 1
      aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj
  24. 3
      aspnet-core/services/src/Lion.AbpPro.DbMigrator/AbpProDbMigratorModule.cs
  25. 2
      aspnet-core/services/src/Lion.AbpPro.DbMigrator/Lion.AbpPro.DbMigrator.csproj
  26. 2
      aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json
  27. 7
      aspnet-core/services/src/Lion.AbpPro.Domain/Users/IUserFreeSqlBasicRepository.cs
  28. 3
      aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj
  29. 17
      aspnet-core/services/src/Lion.AbpPro.FreeSqlRepository/UserFreeSqlBasicRepository.cs
  30. 10
      aspnet-core/services/test/Lion.AbpPro.FreeSqlRepository.Tests/AbpProFreeSqlRepositoryTestBase.cs
  31. 63
      aspnet-core/services/test/Lion.AbpPro.FreeSqlRepository.Tests/AbpProFreeSqlRepositoryTestModule.cs
  32. 18
      aspnet-core/services/test/Lion.AbpPro.FreeSqlRepository.Tests/GlobalUsings.cs
  33. 23
      aspnet-core/services/test/Lion.AbpPro.FreeSqlRepository.Tests/Lion.AbpPro.FreeSqlRepository.Tests.csproj
  34. 21
      aspnet-core/services/test/Lion.AbpPro.FreeSqlRepository.Tests/Users/UserFreeSqlBasicRepository_Tests.cs

2
aspnet-core/Directory.Build.targets

@ -31,6 +31,7 @@
<!-- FreeSql--> <!-- FreeSql-->
<PackageReference Update="FreeSql" Version="3.5.304"/> <PackageReference Update="FreeSql" Version="3.5.304"/>
<PackageReference Update="FreeSql.Provider.MysqlConnector" Version="3.5.304"/> <PackageReference Update="FreeSql.Provider.MysqlConnector" Version="3.5.304"/>
<PackageReference Update="FreeSql.Provider.PostgreSQL" Version="3.5.304"/>
<PackageReference Update="FreeSql.Provider.Sqlite" Version="3.5.304"/> <PackageReference Update="FreeSql.Provider.Sqlite" Version="3.5.304"/>
<!-- 单元测试包--> <!-- 单元测试包-->
@ -50,6 +51,7 @@
<PackageReference Update="DotNetCore.CAP" Version="10.0.0"/> <PackageReference Update="DotNetCore.CAP" Version="10.0.0"/>
<PackageReference Update="DotNetCore.CAP.Dashboard" Version="10.0.0"/> <PackageReference Update="DotNetCore.CAP.Dashboard" Version="10.0.0"/>
<PackageReference Update="DotNetCore.CAP.Mysql" Version="10.0.0"/> <PackageReference Update="DotNetCore.CAP.Mysql" Version="10.0.0"/>
<PackageReference Update="DotNetCore.CAP.PostgreSql" Version="10.0.0"/>
<PackageReference Update="DotNetCore.CAP.RabbitMQ" Version="10.0.0"/> <PackageReference Update="DotNetCore.CAP.RabbitMQ" Version="10.0.0"/>
<PackageReference Update="DotNetCore.CAP.InMemoryStorage" Version="10.0.0"/> <PackageReference Update="DotNetCore.CAP.InMemoryStorage" Version="10.0.0"/>
<PackageReference Update="Savorboard.CAP.InMemoryMessageQueue" Version="8.2.1"/> <PackageReference Update="Savorboard.CAP.InMemoryMessageQueue" Version="8.2.1"/>

21
aspnet-core/Lion.AbpPro.sln

@ -149,10 +149,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lion.AbpPro.FileManagement.
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lion.AbpPro.FileManagement.HttpApi.Host", "modules\FileManagement\host\Lion.AbpPro.FileManagement.HttpApi.Host\Lion.AbpPro.FileManagement.HttpApi.Host.csproj", "{831CD22A-AC6E-4515-AB24-8C96B34C717F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lion.AbpPro.FileManagement.HttpApi.Host", "modules\FileManagement\host\Lion.AbpPro.FileManagement.HttpApi.Host\Lion.AbpPro.FileManagement.HttpApi.Host.csproj", "{831CD22A-AC6E-4515-AB24-8C96B34C717F}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lion.AbpPro.FreeSqlRepository", "services\src\Lion.AbpPro.FreeSqlRepository\Lion.AbpPro.FreeSqlRepository.csproj", "{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.FreeSqlRepository.Tests", "services\test\Lion.AbpPro.FreeSqlRepository.Tests\Lion.AbpPro.FreeSqlRepository.Tests.csproj", "{7971DF5A-B001-4751-8F40-D7752C612BF1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{7FF93622-971D-4B30-A5FC-72D729D26E29}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{7FF93622-971D-4B30-A5FC-72D729D26E29}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.NotificationManagement.HttpApi.Host", "modules\NotificationManagement\host\Lion.AbpPro.NotificationManagement.HttpApi.Host\Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj", "{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.NotificationManagement.HttpApi.Host", "modules\NotificationManagement\host\Lion.AbpPro.NotificationManagement.HttpApi.Host\Lion.AbpPro.NotificationManagement.HttpApi.Host.csproj", "{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}"
@ -255,6 +251,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.Hangfire", "fra
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.SignalR", "frameworks\src\Lion.AbpPro.SignalR\Lion.AbpPro.SignalR.csproj", "{61F9FF69-B06B-4EE6-A34D-6BFA297D3097}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.SignalR", "frameworks\src\Lion.AbpPro.SignalR\Lion.AbpPro.SignalR.csproj", "{61F9FF69-B06B-4EE6-A34D-6BFA297D3097}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.FreeSqlRepository", "frameworks\src\Lion.AbpPro.FreeSqlRepository\Lion.AbpPro.FreeSqlRepository.csproj", "{929F258B-C222-48E5-9668-6FEDF858740F}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -461,14 +459,6 @@ Global
{831CD22A-AC6E-4515-AB24-8C96B34C717F}.Debug|Any CPU.Build.0 = Debug|Any CPU {831CD22A-AC6E-4515-AB24-8C96B34C717F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{831CD22A-AC6E-4515-AB24-8C96B34C717F}.Release|Any CPU.ActiveCfg = Release|Any CPU {831CD22A-AC6E-4515-AB24-8C96B34C717F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{831CD22A-AC6E-4515-AB24-8C96B34C717F}.Release|Any CPU.Build.0 = Release|Any CPU {831CD22A-AC6E-4515-AB24-8C96B34C717F}.Release|Any CPU.Build.0 = Release|Any CPU
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18}.Release|Any CPU.Build.0 = Release|Any CPU
{7971DF5A-B001-4751-8F40-D7752C612BF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7971DF5A-B001-4751-8F40-D7752C612BF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7971DF5A-B001-4751-8F40-D7752C612BF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7971DF5A-B001-4751-8F40-D7752C612BF1}.Release|Any CPU.Build.0 = Release|Any CPU
{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}.Debug|Any CPU.Build.0 = Debug|Any CPU {FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}.Release|Any CPU.ActiveCfg = Release|Any CPU {FA5E029F-1826-4C1E-8AED-6FA5C3362A3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -629,6 +619,10 @@ Global
{61F9FF69-B06B-4EE6-A34D-6BFA297D3097}.Debug|Any CPU.Build.0 = Debug|Any CPU {61F9FF69-B06B-4EE6-A34D-6BFA297D3097}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61F9FF69-B06B-4EE6-A34D-6BFA297D3097}.Release|Any CPU.ActiveCfg = Release|Any CPU {61F9FF69-B06B-4EE6-A34D-6BFA297D3097}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61F9FF69-B06B-4EE6-A34D-6BFA297D3097}.Release|Any CPU.Build.0 = Release|Any CPU {61F9FF69-B06B-4EE6-A34D-6BFA297D3097}.Release|Any CPU.Build.0 = Release|Any CPU
{929F258B-C222-48E5-9668-6FEDF858740F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{929F258B-C222-48E5-9668-6FEDF858740F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{929F258B-C222-48E5-9668-6FEDF858740F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{929F258B-C222-48E5-9668-6FEDF858740F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -698,8 +692,6 @@ Global
{80E12564-E2B3-4307-B40E-20E24BF02916} = {40BF21CB-4520-45A6-A588-5FFB95BAC87C} {80E12564-E2B3-4307-B40E-20E24BF02916} = {40BF21CB-4520-45A6-A588-5FFB95BAC87C}
{78589964-923E-4803-9B74-183487C3ED0F} = {40BF21CB-4520-45A6-A588-5FFB95BAC87C} {78589964-923E-4803-9B74-183487C3ED0F} = {40BF21CB-4520-45A6-A588-5FFB95BAC87C}
{831CD22A-AC6E-4515-AB24-8C96B34C717F} = {C188A1F4-9601-42E5-9A0A-B282E13EAC41} {831CD22A-AC6E-4515-AB24-8C96B34C717F} = {C188A1F4-9601-42E5-9A0A-B282E13EAC41}
{27C7A0E6-4C2E-4AFF-9DE7-1F526DDC0D18} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{7971DF5A-B001-4751-8F40-D7752C612BF1} = {04DBDB01-70F4-4E06-B468-8F87850B22BE}
{7FF93622-971D-4B30-A5FC-72D729D26E29} = {EB2B8705-18E7-49E1-A565-93A6DE5570D5} {7FF93622-971D-4B30-A5FC-72D729D26E29} = {EB2B8705-18E7-49E1-A565-93A6DE5570D5}
{FA5E029F-1826-4C1E-8AED-6FA5C3362A3A} = {7FF93622-971D-4B30-A5FC-72D729D26E29} {FA5E029F-1826-4C1E-8AED-6FA5C3362A3A} = {7FF93622-971D-4B30-A5FC-72D729D26E29}
{C2FE6BA0-3DE5-403F-A91F-BCB9ADA5B068} = {F8A8EB2A-2D4B-464F-9A13-F8F7B6A8FAA3} {C2FE6BA0-3DE5-403F-A91F-BCB9ADA5B068} = {F8A8EB2A-2D4B-464F-9A13-F8F7B6A8FAA3}
@ -751,6 +743,7 @@ Global
{89CCAEA6-8176-4E4B-8D84-A2ACE2715F88} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3} {89CCAEA6-8176-4E4B-8D84-A2ACE2715F88} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
{6C2FDD3D-F711-46B0-A2F2-B94BC33F136B} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3} {6C2FDD3D-F711-46B0-A2F2-B94BC33F136B} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
{61F9FF69-B06B-4EE6-A34D-6BFA297D3097} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3} {61F9FF69-B06B-4EE6-A34D-6BFA297D3097} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
{929F258B-C222-48E5-9668-6FEDF858740F} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F} SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}

12
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreConsts.cs

@ -10,7 +10,7 @@ public class AbpProAspNetCoreConsts
/// <summary> /// <summary>
/// Cookies名称 /// Cookies名称
/// </summary> /// </summary>
public const string DefaultCookieName = "Lion.AbpPro.Http.Api"; public const string DefaultCookieName = "Lion.AbpPro";
/// <summary> /// <summary>
/// Consul网关配置节名称 /// Consul网关配置节名称
@ -46,4 +46,14 @@ public class AbpProAspNetCoreConsts
/// token /// token
/// </summary> /// </summary>
public const string Jwt = "Jwt"; public const string Jwt = "Jwt";
/// <summary>
/// Cookie
/// </summary>
public const string Cookie = "Cookie";
/// <summary>
/// AntiForgery
/// </summary>
public const string AntiForgery = "AntiForgery";
} }

2
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/AbpProAspNetCoreModule.cs

@ -15,5 +15,7 @@ public class AbpProAspNetCoreModule : AbpModule
context.Services.Configure<AbpProSwaggerOptions>(context.Configuration.GetSection(AbpProAspNetCoreConsts.Swagger)); context.Services.Configure<AbpProSwaggerOptions>(context.Configuration.GetSection(AbpProAspNetCoreConsts.Swagger));
context.Services.Configure<AbpProAuditOptions>(context.Configuration.GetSection(AbpProAspNetCoreConsts.Audit)); context.Services.Configure<AbpProAuditOptions>(context.Configuration.GetSection(AbpProAspNetCoreConsts.Audit));
context.Services.Configure<AbpProJwtOptions>(context.Configuration.GetSection(AbpProAspNetCoreConsts.Jwt)); context.Services.Configure<AbpProJwtOptions>(context.Configuration.GetSection(AbpProAspNetCoreConsts.Jwt));
context.Services.Configure<AbpProCookieOptions>(context.Configuration.GetSection(AbpProAspNetCoreConsts.Cookie));
context.Services.Configure<AbpProAntiForgeryOptions>(context.Configuration.GetSection(AbpProAspNetCoreConsts.AntiForgery));
} }
} }

9
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/Options/AbpProAntiForgeryOptions.cs

@ -0,0 +1,9 @@
namespace Lion.AbpPro.AspNetCore.Options;
public class AbpProAntiForgeryOptions
{
/// <summary>
/// 是否启用
/// </summary>
public bool Enabled { get; set; }
}

9
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Lion/AbpPro/AspNetCore/Options/AbpProCookieOptions.cs

@ -0,0 +1,9 @@
namespace Lion.AbpPro.AspNetCore.Options;
public class AbpProCookieOptions
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; } = AbpProAspNetCoreConsts.DefaultCookieName;
}

16
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs

@ -4,7 +4,7 @@ using Lion.AbpPro.AspNetCore.Options;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Swagger;
using Volo.Abp.AspNetCore.Auditing; using Volo.Abp.AspNetCore.Auditing;
using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc.AntiForgery; using Volo.Abp.AspNetCore.Mvc.AntiForgery;
@ -128,7 +128,12 @@ public static class ServiceCollectionExtensions
/// </summary> /// </summary>
public static IServiceCollection AddAbpProAntiForgery(this IServiceCollection service) public static IServiceCollection AddAbpProAntiForgery(this IServiceCollection service)
{ {
service.Configure<AbpAntiForgeryOptions>(options => { options.AutoValidate = false; }); var antiForgeryOptions = service.BuildServiceProvider().GetRequiredService<IOptions<AbpProAntiForgeryOptions>>().Value;
if (antiForgeryOptions.Enabled)
{
service.Configure<AbpAntiForgeryOptions>(options => { options.AutoValidate = antiForgeryOptions.Enabled; });
}
return service; return service;
} }
@ -161,8 +166,8 @@ public static class ServiceCollectionExtensions
options.SwaggerDoc(name, new OpenApiInfo { Title = name, Version = version }); options.SwaggerDoc(name, new OpenApiInfo { Title = name, Version = version });
options.DocInclusionPredicate((docName, description) => true); options.DocInclusionPredicate((docName, description) => true);
//options.EnableAnnotations(); // 启用注解 //options.EnableAnnotations(); // 启用注解
//options.DocumentFilter<HiddenAbpDefaultApiFilter>(); options.DocumentFilter<HiddenAbpDefaultApiFilter>();
//options.SchemaFilter<EnumSchemaFilter>(); options.SchemaFilter<EnumSchemaFilter>();
// 加载所有xml注释,这里会导致swagger加载有点缓慢 // 加载所有xml注释,这里会导致swagger加载有点缓慢
var xmlPaths = Directory.GetFiles(AppContext.BaseDirectory, "*.xml"); var xmlPaths = Directory.GetFiles(AppContext.BaseDirectory, "*.xml");
foreach (var xml in xmlPaths) foreach (var xml in xmlPaths)
@ -244,6 +249,7 @@ public static class ServiceCollectionExtensions
public static IServiceCollection AddAbpProAuthentication(this IServiceCollection service) public static IServiceCollection AddAbpProAuthentication(this IServiceCollection service)
{ {
var jwtOptions = service.BuildServiceProvider().GetRequiredService<IOptions<AbpProJwtOptions>>().Value; var jwtOptions = service.BuildServiceProvider().GetRequiredService<IOptions<AbpProJwtOptions>>().Value;
var cookieOptions = service.BuildServiceProvider().GetRequiredService<IOptions<AbpProCookieOptions>>().Value;
service.AddAuthentication(options => service.AddAuthentication(options =>
{ {
@ -295,7 +301,7 @@ public static class ServiceCollectionExtensions
if (accessToken.IsNullOrWhiteSpace()) if (accessToken.IsNullOrWhiteSpace())
{ {
accessToken = currentContext.Request.Cookies[AbpProAspNetCoreConsts.DefaultCookieName]; accessToken = currentContext.Request.Cookies[cookieOptions.Name];
} }
currentContext.Token = accessToken; currentContext.Token = accessToken;

52
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Swagger/CachingSwaggerProvider.cs

@ -1,26 +1,26 @@
// namespace Swagger; namespace Swagger;
//
// /// <summary> /// <summary>
// /// swagger注释加载慢,把文档添加到缓存 /// swagger注释加载慢,把文档添加到缓存
// /// </summary> /// </summary>
// [Dependency(ReplaceServices = true)] [Dependency(ReplaceServices = true)]
// [ExposeServices(typeof(ISwaggerProvider))] [ExposeServices(typeof(ISwaggerProvider))]
// public class CachingSwaggerProvider : ISwaggerProvider, ITransientDependency public class CachingSwaggerProvider : ISwaggerProvider, ITransientDependency
// { {
// private static readonly ConcurrentDictionary<string, OpenApiDocument> _cache = new ConcurrentDictionary<string, OpenApiDocument>(); private static readonly ConcurrentDictionary<string, OpenApiDocument> _cache = new ConcurrentDictionary<string, OpenApiDocument>();
//
// private readonly SwaggerGenerator _swaggerGenerator; private readonly SwaggerGenerator _swaggerGenerator;
//
// public CachingSwaggerProvider( public CachingSwaggerProvider(
// IOptions<SwaggerGeneratorOptions> optionsAccessor, IOptions<SwaggerGeneratorOptions> optionsAccessor,
// IApiDescriptionGroupCollectionProvider apiDescriptionsProvider, IApiDescriptionGroupCollectionProvider apiDescriptionsProvider,
// ISchemaGenerator schemaGenerator) ISchemaGenerator schemaGenerator)
// { {
// _swaggerGenerator = new SwaggerGenerator(optionsAccessor.Value, apiDescriptionsProvider, schemaGenerator); _swaggerGenerator = new SwaggerGenerator(optionsAccessor.Value, apiDescriptionsProvider, schemaGenerator);
// } }
//
// public OpenApiDocument GetSwagger(string documentName, string host = null, string basePath = null) public OpenApiDocument GetSwagger(string documentName, string host = null, string basePath = null)
// { {
// return _cache.GetOrAdd(documentName, (_) => _swaggerGenerator.GetSwagger(documentName, host, basePath)); return _cache.GetOrAdd(documentName, (_) => _swaggerGenerator.GetSwagger(documentName, host, basePath));
// } }
// } }

42
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Swagger/EnumSchemaFilter.cs

@ -1,21 +1,21 @@
// namespace Swagger; namespace Swagger;
//
// /// <summary> /// <summary>
// /// swagger 枚举映射, /// swagger 枚举映射,
// /// 原因:前端代理生成枚举是数字 /// 原因:前端代理生成枚举是数字
// /// </summary> /// </summary>
// public class EnumSchemaFilter : ISchemaFilter public class EnumSchemaFilter : ISchemaFilter
// { {
// public void Apply(OpenApiSchema schema, SchemaFilterContext context) public void Apply(OpenApiSchema schema, SchemaFilterContext context)
// { {
// if (context.Type.IsEnum) if (context.Type.IsEnum)
// { {
// var array = new OpenApiArray(); var array = new OpenApiArray();
// array.AddRange(Enum.GetNames(context.Type).Select(n => new OpenApiString(n))); array.AddRange(Enum.GetNames(context.Type).Select(n => new OpenApiString(n)));
// // NSwag // NSwag
// schema.Extensions.Add("x-enumNames", array); schema.Extensions.Add("x-enumNames", array);
// // Openapi-generator // Openapi-generator
// schema.Extensions.Add("x-enum-varnames", array); schema.Extensions.Add("x-enum-varnames", array);
// } }
// } }
// } }

96
aspnet-core/frameworks/src/Lion.AbpPro.AspNetCore/Swagger/HiddenAbpDefaultApiFilter.cs

@ -1,48 +1,48 @@
// namespace Swagger; namespace Swagger;
//
// /// <summary> /// <summary>
// /// 在使用nswag的时候,原生默认的api导致生产的代理类存在问题 /// 在使用nswag的时候,原生默认的api导致生产的代理类存在问题
// /// 所有隐藏原生的api,重写路由 /// 所有隐藏原生的api,重写路由
// /// </summary> /// </summary>
// public class HiddenAbpDefaultApiFilter : IDocumentFilter public class HiddenAbpDefaultApiFilter : IDocumentFilter
// { {
// public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
// { {
// foreach (ApiDescription apiDescription in context.ApiDescriptions) foreach (ApiDescription apiDescription in context.ApiDescriptions)
// { {
// if (apiDescription.TryGetMethodInfo(out MethodInfo method)) if (apiDescription.TryGetMethodInfo(out MethodInfo method))
// { {
// string key = "/" + apiDescription.RelativePath; string key = "/" + apiDescription.RelativePath;
// var reuslt = IsHidden(key); var reuslt = IsHidden(key);
// if (reuslt) swaggerDoc.Paths.Remove(key); if (reuslt) swaggerDoc.Paths.Remove(key);
// } }
// } }
// } }
//
// private bool IsHidden(string key) private bool IsHidden(string key)
// { {
// var list = GetHiddenAbpDefaultApiList(); var list = GetHiddenAbpDefaultApiList();
// foreach (var item in list) foreach (var item in list)
// { {
// if (key.Contains(item)) return true; if (key.Contains(item)) return true;
// } }
//
// return false; return false;
// } }
//
// private List<string> GetHiddenAbpDefaultApiList() private List<string> GetHiddenAbpDefaultApiList()
// { {
// return new List<string>() { return new List<string>() {
// "/api/abp/multi-tenancy/tenants", "/api/abp/multi-tenancy/tenants",
// "/api/account", "/api/account",
// "/api/feature-management/features", "/api/feature-management/features",
// "/api/permission-management/permissions", "/api/permission-management/permissions",
// "/api/identity/my-profile", "/api/identity/my-profile",
// "/api/identity", "/api/identity",
// "/api/multi-tenancy/tenants", "/api/multi-tenancy/tenants",
// "/api/setting-management/emailing", "/api/setting-management/emailing",
// "/configuration", "/configuration",
// "/outputcache" "/outputcache"
// }; };
// } }
// } }

12
aspnet-core/services/src/Lion.AbpPro.FreeSqlRepository/AbpProFreeSqlModule.cs → aspnet-core/frameworks/src/Lion.AbpPro.FreeSqlRepository/AbpProFreeSqlModule.cs

@ -7,14 +7,14 @@ public class AbpProFreeSqlModule : AbpModule
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
var connectionString = configuration.GetConnectionString("Default"); var connectionString = configuration.GetConnectionString("Default");
var freeSql = new FreeSql.FreeSqlBuilder() var freeSql = new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.MySql, connectionString) .UseConnectionString(FreeSql.DataType.OdbcPostgreSQL, connectionString)
.Build(); .Build();
freeSql.Aop.CurdAfter += (s, e) => // freeSql.Aop.CurdAfter += (s, e) =>
{ // {
Console.WriteLine($"ManagedThreadId:{Thread.CurrentThread.ManagedThreadId};" + // Console.WriteLine($"ManagedThreadId:{Thread.CurrentThread.ManagedThreadId};" +
$" FullName:{e.EntityType.FullName} ElapsedMilliseconds:{e.ElapsedMilliseconds}ms, {e.Sql}"); // $" FullName:{e.EntityType.FullName} ElapsedMilliseconds:{e.ElapsedMilliseconds}ms, {e.Sql}");
}; // };
context.Services.AddSingleton<IFreeSql>(freeSql); context.Services.AddSingleton<IFreeSql>(freeSql);
} }

0
aspnet-core/services/src/Lion.AbpPro.FreeSqlRepository/FreeSqlBasicRepository.cs → aspnet-core/frameworks/src/Lion.AbpPro.FreeSqlRepository/FreeSqlBasicRepository.cs

0
aspnet-core/services/src/Lion.AbpPro.FreeSqlRepository/GlobalUsings.cs → aspnet-core/frameworks/src/Lion.AbpPro.FreeSqlRepository/GlobalUsings.cs

2
aspnet-core/services/src/Lion.AbpPro.FreeSqlRepository/Lion.AbpPro.FreeSqlRepository.csproj → aspnet-core/frameworks/src/Lion.AbpPro.FreeSqlRepository/Lion.AbpPro.FreeSqlRepository.csproj

@ -7,7 +7,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="FreeSql" /> <PackageReference Include="FreeSql" />
<PackageReference Include="FreeSql.Provider.MysqlConnector" /> <PackageReference Include="FreeSql.Provider.PostgreSQL" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

5
aspnet-core/modules/LanguageManagement/src/Lion.AbpPro.LanguageManagement.Domain/DatabaseLanguageProvider.cs

@ -1,5 +1,4 @@
using Lion.AbpPro.LanguageManagement.Languages; using Lion.AbpPro.LanguageManagement.Languages;
using Mapster;
namespace Lion.AbpPro.LanguageManagement; namespace Lion.AbpPro.LanguageManagement;
@ -8,13 +7,11 @@ public class DatabaseLanguageProvider : ILanguageProvider, ITransientDependency
{ {
private readonly ILanguageManager _languageManager; private readonly ILanguageManager _languageManager;
private readonly IDistributedCache<LanguageListCacheItem> _distributedCache; private readonly IDistributedCache<LanguageListCacheItem> _distributedCache;
private readonly IObjectMapper _objectMapper;
public DatabaseLanguageProvider(ILanguageManager languageManager, IDistributedCache<LanguageListCacheItem> distributedCache, IObjectMapper objectMapper) public DatabaseLanguageProvider(ILanguageManager languageManager, IDistributedCache<LanguageListCacheItem> distributedCache)
{ {
_languageManager = languageManager; _languageManager = languageManager;
_distributedCache = distributedCache; _distributedCache = distributedCache;
_objectMapper = objectMapper;
} }
public virtual async Task<IReadOnlyList<LanguageInfo>> GetLanguagesAsync() public virtual async Task<IReadOnlyList<LanguageInfo>> GetLanguagesAsync()

2
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj

@ -22,7 +22,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis"/> <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis"/>
<PackageReference Include="DotNetCore.CAP.MySql"/> <PackageReference Include="DotNetCore.CAP.PostgreSql"/>
<PackageReference Include="DotNetCore.CAP.RabbitMQ"/> <PackageReference Include="DotNetCore.CAP.RabbitMQ"/>
<PackageReference Include="DotNetCore.CAP.Dashboard"/> <PackageReference Include="DotNetCore.CAP.Dashboard"/>
<PackageReference Include="DistributedLock.Redis"/> <PackageReference Include="DistributedLock.Redis"/>

67
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Development.json

@ -0,0 +1,67 @@
{
"ConnectionStrings": {
//"Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
"Default": "User ID=postgres;Password=1q2w3E*;Host=localhost;Port=5432;Database=LionAbpProDemo10;"
},
"Hangfire": {
"Redis": {
"Host": "localhost:6379,password=1q2w3E*",
"DB": "2"
}
},
"Redis": {
"Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=2"
},
"Jwt": {
"Audience": "Lion.AbpPro",
"SecurityKey": "dzehzRz9a8asdfasfdadfasdfasdfafsdadfasbasdf=",
"Issuer": "Lion.AbpPro",
"ExpirationTime": 2
},
"Cap": {
"RabbitMq": {
"HostName": "localhost",
"UserName": "admin",
"Password": "1q2w3E*",
"Port": 5672
}
},
"ElasticSearch": {
"Host": "http://es.cn",
"UserName": "elastic",
"Password": "aVVhjQ95RP7nbwNy"
},
"MiniProfiler": {
"Enabled": true,
"RouteBasePath": "/profiler"
},
"Swagger": {
"Enabled": true
},
"Audit": {
"Enabled": true,
"ApplicationName": "Lion.AbpPro"
},
"Cors": {
"Enabled": true,
"CorsOrigins": "http://localhost:4200,http://localhost:4201"
},
"Consul": {
"Enabled": false,
"ServiceUrl": "http://localhost:8500",
"ClientName": "Lion.AbpPro.Api",
"ClientAddress": "localhost",
"ClientPort": 44315,
"HealthUrl": "http://localhost:44315/health",
"DeregisterCriticalServiceAfter": 30,
"Interval": 30,
"Timeout": 30
},
"MultiTenancy": {
"Enabled": true
},
"Preheat": {
"Enabled": true,
"RequestUrl": "http://localhost:44315/api/abp/application-configuration?IncludeLocalizationResources=false"
}
}

61
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Production.json

@ -1,50 +1,7 @@
{ {
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.File"
],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Information",
"Volo.Abp": "Information",
"Hangfire": "Information",
"DotNetCore.CAP": "Information",
"Serilog.AspNetCore": "Information",
"Microsoft.EntityFrameworkCore": "Warning",
"Microsoft.AspNetCore": "Information"
}
},
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "File",
"Args": {
"path": "logs/logs-.txt",
"rollingInterval": "Day"
}
},
{
"Name": "Elastic",
"Args": {
"Enabled": false,
"Url": "http://es.cn",
"IndexFormat": "Lion.AbpPro.development.{0:yyyy.MM.dd}",
"UserName": "elastic",
"Password": "aVVhjQ95RP7nbwNy",
"ApplicationName": "Lion.AbpPro.HttpApi.Host"
}
}
]
},
"App": {
"SelfUrl": "http://localhost:44315",
},
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=f616b8803ac7a9a0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" //"Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
"Default": "User ID=postgres;Password=1q2w3E*;Host=localhost;Port=5432;Database=LionAbpProDemo10;"
}, },
"Hangfire": { "Hangfire": {
"Redis": { "Redis": {
@ -53,7 +10,7 @@
} }
}, },
"Redis": { "Redis": {
"Configuration": "localhost:6379,password=75He82bB5jFA84XZ1,defaultdatabase=2" "Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=2"
}, },
"Jwt": { "Jwt": {
"Audience": "Lion.AbpPro", "Audience": "Lion.AbpPro",
@ -89,8 +46,16 @@
"Enabled": true, "Enabled": true,
"CorsOrigins": "http://localhost:4200,http://localhost:4201" "CorsOrigins": "http://localhost:4200,http://localhost:4201"
}, },
"Gateway": { "Consul": {
"Enabled": false "Enabled": false,
"ServiceUrl": "http://localhost:8500",
"ClientName": "Lion.AbpPro.Api",
"ClientAddress": "localhost",
"ClientPort": 44315,
"HealthUrl": "http://localhost:44315/health",
"DeregisterCriticalServiceAfter": 30,
"Interval": 30,
"Timeout": 30
}, },
"MultiTenancy": { "MultiTenancy": {
"Enabled": true "Enabled": true

65
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json

@ -42,70 +42,5 @@
}, },
"App": { "App": {
"SelfUrl": "http://localhost:44315", "SelfUrl": "http://localhost:44315",
},
"ConnectionStrings": {
//"Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
"Default": "User ID=postgres;Password=1q2w3E*;Host=localhost;Port=5432;Database=LionAbpProDemo10;"
},
"Hangfire": {
"Redis": {
"Host": "localhost:6379,password=1q2w3E*",
"DB": "2"
}
},
"Redis": {
"Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=2"
},
"Jwt": {
"Audience": "Lion.AbpPro",
"SecurityKey": "dzehzRz9a8asdfasfdadfasdfasdfafsdadfasbasdf=",
"Issuer": "Lion.AbpPro",
"ExpirationTime": 2
},
"Cap": {
"RabbitMq": {
"HostName": "localhost",
"UserName": "admin",
"Password": "1q2w3E*",
"Port": 5672
}
},
"ElasticSearch": {
"Host": "http://es.cn",
"UserName": "elastic",
"Password": "aVVhjQ95RP7nbwNy"
},
"MiniProfiler": {
"Enabled": true,
"RouteBasePath": "/profiler"
},
"Swagger": {
"Enabled": true
},
"Audit": {
"Enabled": true,
"ApplicationName": "Lion.AbpPro"
},
"Cors": {
"Enabled": true,
"CorsOrigins": "http://localhost:4200,http://localhost:4201"
},
"Consul": {
"Enabled": false,
"ServiceUrl": "http://localhost:8500",
"ClientName": "Lion.AbpPro.Api",
"ClientAddress": "localhost",
"ClientPort": 44315,
"HealthUrl": "http://localhost:44315/health",
"DeregisterCriticalServiceAfter": 30,
"Interval": 30,
"Timeout": 30
},
"MultiTenancy": {
"Enabled": true
},
"Preheat": {
"Enabled": true,
"RequestUrl": "http://localhost:44315/api/abp/application-configuration?IncludeLocalizationResources=false"
} }
} }

5
aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj

@ -15,9 +15,4 @@
<ProjectReference Include="..\Lion.AbpPro.Domain.Shared\Lion.AbpPro.Domain.Shared.csproj" /> <ProjectReference Include="..\Lion.AbpPro.Domain.Shared\Lion.AbpPro.Domain.Shared.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.ObjectExtending" />
</ItemGroup>
</Project> </Project>

3
aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationModule.cs

@ -10,8 +10,7 @@ namespace Lion.AbpPro
typeof(NotificationManagementApplicationModule), typeof(NotificationManagementApplicationModule),
typeof(LanguageManagementApplicationModule), typeof(LanguageManagementApplicationModule),
typeof(NotificationManagementApplicationModule), typeof(NotificationManagementApplicationModule),
typeof(FileManagementApplicationModule), typeof(FileManagementApplicationModule)
typeof(AbpProFreeSqlModule)
)] )]
public class AbpProApplicationModule : AbpModule public class AbpProApplicationModule : AbpModule
{ {

1
aspnet-core/services/src/Lion.AbpPro.Application/GlobalUsings.cs

@ -7,7 +7,6 @@ global using System.Threading.Tasks;
global using Lion.AbpPro.BasicManagement; global using Lion.AbpPro.BasicManagement;
global using Lion.AbpPro.DataDictionaryManagement; global using Lion.AbpPro.DataDictionaryManagement;
global using Lion.AbpPro.Core; global using Lion.AbpPro.Core;
global using Lion.AbpPro.FreeSqlRepository;
global using Lion.AbpPro.LanguageManagement; global using Lion.AbpPro.LanguageManagement;
global using Lion.AbpPro.NotificationManagement; global using Lion.AbpPro.NotificationManagement;
global using Lion.AbpPro.Permissions; global using Lion.AbpPro.Permissions;

1
aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj

@ -15,7 +15,6 @@
<ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.Application\Lion.AbpPro.LanguageManagement.Application.csproj" /> <ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.Application\Lion.AbpPro.LanguageManagement.Application.csproj" />
<ProjectReference Include="..\Lion.AbpPro.Domain\Lion.AbpPro.Domain.csproj" /> <ProjectReference Include="..\Lion.AbpPro.Domain\Lion.AbpPro.Domain.csproj" />
<ProjectReference Include="..\Lion.AbpPro.Application.Contracts\Lion.AbpPro.Application.Contracts.csproj" /> <ProjectReference Include="..\Lion.AbpPro.Application.Contracts\Lion.AbpPro.Application.Contracts.csproj" />
<ProjectReference Include="..\Lion.AbpPro.FreeSqlRepository\Lion.AbpPro.FreeSqlRepository.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

3
aspnet-core/services/src/Lion.AbpPro.DbMigrator/AbpProDbMigratorModule.cs

@ -5,8 +5,7 @@ namespace Lion.AbpPro.DbMigrator
{ {
[DependsOn( [DependsOn(
typeof(AbpAutofacModule), typeof(AbpAutofacModule),
typeof(AbpProEntityFrameworkCoreModule), typeof(AbpProEntityFrameworkCoreModule)
typeof(AbpProApplicationContractsModule)
)] )]
public class AbpProDbMigratorModule : AbpModule public class AbpProDbMigratorModule : AbpModule
{ {

2
aspnet-core/services/src/Lion.AbpPro.DbMigrator/Lion.AbpPro.DbMigrator.csproj

@ -17,8 +17,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Lion.AbpPro.Application.Contracts\Lion.AbpPro.Application.Contracts.csproj" />
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore\Lion.AbpPro.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore\Lion.AbpPro.EntityFrameworkCore.csproj" />
</ItemGroup> </ItemGroup>

2
aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json

@ -1,6 +1,6 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
// "Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo10;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" // "Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo10;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
"Default": "User ID=postgres;Password=1q2w3E*;Host=localhost;Port=5432;Database=LionAbpProDemo10;" "Default": "User ID=postgres;Password=1q2w3E*;Host=localhost;Port=5432;Database=LionAbpProDemo1000;"
} }
} }

7
aspnet-core/services/src/Lion.AbpPro.Domain/Users/IUserFreeSqlBasicRepository.cs

@ -1,7 +0,0 @@
namespace Lion.AbpPro.Users
{
public interface IUserFreeSqlBasicRepository
{
Task<List<UserOutput>> GetListAsync();
}
}

3
aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj

@ -13,14 +13,13 @@
<ProjectReference Include="..\..\..\modules\NotificationManagement\src\Lion.AbpPro.NotificationManagement.EntityFrameworkCore\Lion.AbpPro.NotificationManagement.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\..\modules\NotificationManagement\src\Lion.AbpPro.NotificationManagement.EntityFrameworkCore\Lion.AbpPro.NotificationManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.EntityFrameworkCore\Lion.AbpPro.LanguageManagement.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.EntityFrameworkCore\Lion.AbpPro.LanguageManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\Lion.AbpPro.Domain\Lion.AbpPro.Domain.csproj" /> <ProjectReference Include="..\Lion.AbpPro.Domain\Lion.AbpPro.Domain.csproj" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>compile; contentFiles; build; buildMultitargeting; buildTransitive; analyzers; native</PrivateAssets> <PrivateAssets>compile; contentFiles; build; buildMultitargeting; buildTransitive; analyzers; native</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" Version="10.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

17
aspnet-core/services/src/Lion.AbpPro.FreeSqlRepository/UserFreeSqlBasicRepository.cs

@ -1,17 +0,0 @@
using Lion.AbpPro.Users;
using Lion.AbpPro.Users.Dto;
namespace Lion.AbpPro.FreeSqlRepository
{
public class UserFreeSqlBasicRepository : FreeSqlBasicRepository, IUserFreeSqlBasicRepository
{
public async Task<List<UserOutput>> GetListAsync()
{
var sql = "select id from AbpUsers";
var result = await FreeSql.Select<UserOutput>()
.WithSql(sql)
.ToListAsync();
return result;
}
}
}

10
aspnet-core/services/test/Lion.AbpPro.FreeSqlRepository.Tests/AbpProFreeSqlRepositoryTestBase.cs

@ -1,10 +0,0 @@
namespace Lion.AbpPro.FreeSqlRepository.Tests
{
public abstract class AbpProFreeSqlRepositoryTestBase: AbpProTestBase<AbpProFreeSqlRepositoryTestModule>
{
protected AbpProFreeSqlRepositoryTestBase()
{
}
}
}

63
aspnet-core/services/test/Lion.AbpPro.FreeSqlRepository.Tests/AbpProFreeSqlRepositoryTestModule.cs

@ -1,63 +0,0 @@
namespace Lion.AbpPro.FreeSqlReppsitory.Tests;
[DependsOn(
typeof(AbpProTestBaseModule),
typeof(AbpProEntityFrameworkCoreModule),
typeof(AbpEntityFrameworkCoreSqliteModule),
typeof(AbpProFreeSqlModule)
)]
public class AbpProFreeSqlRepositoryTestModule : AbpModule
{
private SqliteConnection _sqliteConnection;
private const string ConnectionString = "Data Source=:memory:";
public override void ConfigureServices(ServiceConfigurationContext context)
{
var freeSql = new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.Sqlite, ConnectionString)
.UseAutoSyncStructure(true)
.Build();
context.Services.AddSingleton<IFreeSql>(freeSql);
ConfigureInMemorySqlite(context.Services,freeSql);
}
private void ConfigureInMemorySqlite(IServiceCollection services,IFreeSql freeSql)
{
_sqliteConnection = CreateDatabaseAndGetConnection(freeSql);
services.Configure<AbpDbContextOptions>(options =>
{
options.Configure(context =>
{
context.DbContextOptions.UseSqlite(_sqliteConnection);
});
});
}
public override void OnApplicationShutdown(ApplicationShutdownContext context)
{
_sqliteConnection.Dispose();
}
private static SqliteConnection CreateDatabaseAndGetConnection(IFreeSql freeSql)
{
var connection = new SqliteConnection(ConnectionString);
connection.Open();
var options = new DbContextOptionsBuilder<AbpProDbContext>()
.UseSqlite(connection)
.Options;
using (var context = new AbpProDbContext(options))
{
foreach (var entityType in context.Model.GetEntityTypes())
{
freeSql.CodeFirst.SyncStructure(entityType.ClrType, entityType.GetTableName(), true);
}
context.GetService<IRelationalDatabaseCreator>().CreateTables();
}
return connection;
}
}

18
aspnet-core/services/test/Lion.AbpPro.FreeSqlRepository.Tests/GlobalUsings.cs

@ -1,18 +0,0 @@
// Global using directives
global using System.Threading.Tasks;
global using Lion.AbpPro.EntityFrameworkCore;
global using Lion.AbpPro.FreeSqlRepository;
global using Lion.AbpPro.FreeSqlReppsitory.Tests;
global using Lion.AbpPro.Users;
global using Microsoft.Data.Sqlite;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.EntityFrameworkCore.Infrastructure;
global using Microsoft.EntityFrameworkCore.Storage;
global using Microsoft.Extensions.DependencyInjection;
global using Shouldly;
global using Volo.Abp;
global using Volo.Abp.EntityFrameworkCore;
global using Volo.Abp.EntityFrameworkCore.Sqlite;
global using Volo.Abp.Modularity;
global using Xunit;

23
aspnet-core/services/test/Lion.AbpPro.FreeSqlRepository.Tests/Lion.AbpPro.FreeSqlRepository.Tests.csproj

@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Lion.AbpPro.FreeSqlRepository.Tests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="FreeSql.Provider.Sqlite" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.Sqlite" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Lion.AbpPro.EntityFrameworkCore\Lion.AbpPro.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\src\Lion.AbpPro.FreeSqlRepository\Lion.AbpPro.FreeSqlRepository.csproj" />
<ProjectReference Include="..\Lion.AbpPro.TestBase\Lion.AbpPro.TestBase.csproj" />
</ItemGroup>
</Project>

21
aspnet-core/services/test/Lion.AbpPro.FreeSqlRepository.Tests/Users/UserFreeSqlBasicRepository_Tests.cs

@ -1,21 +0,0 @@
namespace Lion.AbpPro.FreeSqlRepository.Tests.Users
{
public class UserFreeSqlBasicRepository_Tests: AbpProFreeSqlRepositoryTestBase
{
private readonly IUserFreeSqlBasicRepository _userFreeSqlBasicRepository;
public UserFreeSqlBasicRepository_Tests()
{
_userFreeSqlBasicRepository = GetRequiredService<IUserFreeSqlBasicRepository>();
}
[Fact]
public async Task Should_NotThrow_ListAsyncTest()
{
var result = await _userFreeSqlBasicRepository.GetListAsync();
result.ShouldNotBeNull();
}
}
}
Loading…
Cancel
Save