Browse Source

feat: cap支持多租户

feat/cap 9.1.0.1
Hanpaopao 1 year ago
parent
commit
08e1b70e5a
  1. 5
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProCAPSubscribeInvoker.cs
  2. 1
      aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProCapServiceCollectionExtensions.cs
  3. 10
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
  4. 2
      aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json

5
aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProCAPSubscribeInvoker.cs

@ -5,12 +5,13 @@ using Microsoft.Extensions.Internal;
namespace Lion.AbpPro.CAP; namespace Lion.AbpPro.CAP;
public class AbpProCAPSubscribeInvoker public class AbpProCAPSubscribeInvoker : ISubscribeInvoker
{ {
private readonly ConcurrentDictionary<string, ObjectMethodExecutor> _executors; private readonly ConcurrentDictionary<string, ObjectMethodExecutor> _executors;
private readonly ISerializer _serializer; private readonly ISerializer _serializer;
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private readonly ICurrentTenant _currentTenant; private readonly ICurrentTenant _currentTenant;
public AbpProCAPSubscribeInvoker(IServiceProvider serviceProvider, ISerializer serializer, ICurrentTenant currentTenant) public AbpProCAPSubscribeInvoker(IServiceProvider serviceProvider, ISerializer serializer, ICurrentTenant currentTenant)
{ {
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
@ -95,7 +96,7 @@ public class AbpProCAPSubscribeInvoker
{ {
resultObj = await ExecuteWithParameterAsync(executor, obj, executeParameters).ConfigureAwait(false); resultObj = await ExecuteWithParameterAsync(executor, obj, executeParameters).ConfigureAwait(false);
} }
if (filter != null) if (filter != null)
{ {
var edContext = new ExecutedContext(context, resultObj); var edContext = new ExecutedContext(context, resultObj);

1
aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProCapServiceCollectionExtensions.cs

@ -6,6 +6,7 @@ public static class AbpProCapServiceCollectionExtensions
{ {
context.Services.Replace(ServiceDescriptor.Transient<IUnitOfWork, AbpProCapUnitOfWork>()); context.Services.Replace(ServiceDescriptor.Transient<IUnitOfWork, AbpProCapUnitOfWork>());
context.Services.Replace(ServiceDescriptor.Transient<UnitOfWork, AbpProCapUnitOfWork>()); context.Services.Replace(ServiceDescriptor.Transient<UnitOfWork, AbpProCapUnitOfWork>());
context.Services.AddSingleton<ISubscribeInvoker, AbpProCAPSubscribeInvoker>();
context.Services.AddTransient<AbpProCapUnitOfWork>(); context.Services.AddTransient<AbpProCapUnitOfWork>();
context.Services.AddCap(capAction); context.Services.AddCap(capAction);
return context; return context;

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

@ -31,19 +31,19 @@
}, },
"App": { "App": {
"SelfUrl": "http://localhost:44315", "SelfUrl": "http://localhost:44315",
"CorsOrigins": "https://*.AbpPro.com,http://localhost:4200,http://182.43.18.151:44320,http://182.43.18.151:44321,http://182.43.18.151:44322,http://182.43.18.151:44318" "CorsOrigins": "https://*.AbpPro.com,http://localhost:4200,http://localhost:44320,http://localhost:44321,http://localhost:44322,http://localhost:44318"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Data Source=182.43.18.151;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=IFKy!Cufe3V9sYcz;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"
}, },
"Hangfire": { "Hangfire": {
"Redis": { "Redis": {
"Host": "182.43.18.151:6379,password=1q2w3E*", "Host": "localhost:6379,password=1q2w3E*",
"DB": "2" "DB": "2"
} }
}, },
"Redis": { "Redis": {
"Configuration": "182.43.18.151:6379,password=1q2w3E*,defaultdatabase=9" "Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=9"
}, },
"Jwt": { "Jwt": {
"Audience": "Lion.AbpPro", "Audience": "Lion.AbpPro",
@ -52,7 +52,7 @@
"ExpirationTime": 2 "ExpirationTime": 2
}, },
"Cap": { "Cap": {
"Enabled": false, "Enabled": true,
"RabbitMq": { "RabbitMq": {
"HostName": "localhost", "HostName": "localhost",
"UserName": "admin", "UserName": "admin",

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

@ -1,5 +1,5 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Data Source=localhost;Port=3306;Database=LionAbpPro91;uid=root;pwd=1q2w3E*;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"
} }
} }
Loading…
Cancel
Save