diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN.Abp.Account.Application.Contracts.csproj b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN.Abp.Account.Application.Contracts.csproj
index 5af03b5ac..c7b9a6dcc 100644
--- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN.Abp.Account.Application.Contracts.csproj
+++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN.Abp.Account.Application.Contracts.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN.Abp.Account.Application.csproj b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN.Abp.Account.Application.csproj
index 76f881c40..74eb6ad56 100644
--- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN.Abp.Account.Application.csproj
+++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN.Abp.Account.Application.csproj
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN.Abp.Account.Domain.Shared.csproj b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN.Abp.Account.Domain.Shared.csproj
index a112fa029..f780f22ba 100644
--- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN.Abp.Account.Domain.Shared.csproj
+++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN.Abp.Account.Domain.Shared.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN.Abp.Account.Domain.csproj b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN.Abp.Account.Domain.csproj
index 39eb53e30..131db7a6e 100644
--- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN.Abp.Account.Domain.csproj
+++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN.Abp.Account.Domain.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN.Abp.Account.HttpApi.csproj b/aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN.Abp.Account.HttpApi.csproj
index fa41d5931..72231cea6 100644
--- a/aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN.Abp.Account.HttpApi.csproj
+++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN.Abp.Account.HttpApi.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/LINGYUN.Abp.Account.Web.csproj b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/LINGYUN.Abp.Account.Web.csproj
index e09839e0c..79d80c06d 100644
--- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/LINGYUN.Abp.Account.Web.csproj
+++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/LINGYUN.Abp.Account.Web.csproj
@@ -29,9 +29,9 @@
-
-
-
+
+
+
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application.Contracts/LINGYUN.ApiGateway.Application.Contracts.csproj b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application.Contracts/LINGYUN.ApiGateway.Application.Contracts.csproj
index 33cd29545..377c06860 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application.Contracts/LINGYUN.ApiGateway.Application.Contracts.csproj
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application.Contracts/LINGYUN.ApiGateway.Application.Contracts.csproj
@@ -18,8 +18,8 @@
-
-
+
+
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN.ApiGateway.Application.csproj b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN.ApiGateway.Application.csproj
index 8d12cf4e8..9770e4101 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN.ApiGateway.Application.csproj
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN.ApiGateway.Application.csproj
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/AggregateReRouteAppService.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/AggregateReRouteAppService.cs
index 77b125687..b9de682e7 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/AggregateReRouteAppService.cs
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/AggregateReRouteAppService.cs
@@ -15,8 +15,7 @@ namespace LINGYUN.ApiGateway.Ocelot
[Authorize(ApiGatewayPermissions.AggregateRoute.Default)]
public class AggregateReRouteAppService : ApiGatewayApplicationServiceBase, IAggregateReRouteAppService
{
- private IDistributedEventBus _eventBus;
- protected IDistributedEventBus DistributedEventBus => LazyGetRequiredService(ref _eventBus);
+ protected IDistributedEventBus DistributedEventBus => LazyServiceProvider.LazyGetRequiredService();
private readonly IAggregateReRouteRepository _aggregateReRouteRepository;
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/GlobalConfigurationAppService.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/GlobalConfigurationAppService.cs
index 3e795b7c2..25043cc1c 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/GlobalConfigurationAppService.cs
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/GlobalConfigurationAppService.cs
@@ -11,8 +11,7 @@ namespace LINGYUN.ApiGateway.Ocelot
[Authorize(ApiGatewayPermissions.Global.Default)]
public class GlobalConfigurationAppService : ApiGatewayApplicationServiceBase, IGlobalConfigurationAppService
{
- private IDistributedEventBus _eventBus;
- protected IDistributedEventBus DistributedEventBus => LazyGetRequiredService(ref _eventBus);
+ protected IDistributedEventBus DistributedEventBus => LazyServiceProvider.LazyGetRequiredService();
private readonly IRouteGroupChecker _routeGroupChecker;
private readonly IGlobalConfigRepository _globalConfigRepository;
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/ReRouteAppService.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/ReRouteAppService.cs
index eb69995cc..3c0f9b466 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/ReRouteAppService.cs
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/ReRouteAppService.cs
@@ -10,8 +10,7 @@ namespace LINGYUN.ApiGateway.Ocelot
[Authorize(ApiGatewayPermissions.Route.Default)]
public class ReRouteAppService : ApiGatewayApplicationServiceBase, IReRouteAppService
{
- private IDistributedEventBus _eventBus;
- protected IDistributedEventBus DistributedEventBus => LazyGetRequiredService(ref _eventBus);
+ protected IDistributedEventBus DistributedEventBus => LazyServiceProvider.LazyGetRequiredService();
private readonly IRouteGroupChecker _routeGroupChecker;
private readonly IReRouteRepository _reRouteRepository;
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/RouteGroupAppService.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/RouteGroupAppService.cs
index 91fb2b0a1..bb5d3ceea 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/RouteGroupAppService.cs
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/RouteGroupAppService.cs
@@ -10,8 +10,7 @@ namespace LINGYUN.ApiGateway.Ocelot
[Authorize(ApiGatewayPermissions.RouteGroup.Default)]
public class RouteGroupAppService : ApiGatewayApplicationServiceBase, IRouteGroupAppService
{
- private IDataFilter _dataFilter;
- protected IDataFilter DataFilter => LazyGetRequiredService(ref _dataFilter);
+ protected IDataFilter DataFilter => LazyServiceProvider.LazyGetRequiredService();
protected IRouteGroupRepository RouterRepository { get; }
public RouteGroupAppService(
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN.ApiGateway.Domain.Shared.csproj b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN.ApiGateway.Domain.Shared.csproj
index 811736e63..769a43349 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN.ApiGateway.Domain.Shared.csproj
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN.ApiGateway.Domain.Shared.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain/LINGYUN.ApiGateway.Domain.csproj b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain/LINGYUN.ApiGateway.Domain.csproj
index 6e20cad47..6931853e7 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain/LINGYUN.ApiGateway.Domain.csproj
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain/LINGYUN.ApiGateway.Domain.csproj
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN.ApiGateway.EntityFrameworkCore.csproj b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN.ApiGateway.EntityFrameworkCore.csproj
index 6167ff624..7feeb1ba6 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN.ApiGateway.EntityFrameworkCore.csproj
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN.ApiGateway.EntityFrameworkCore.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreAggregateReRouteRepository.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreAggregateReRouteRepository.cs
index 1320dda17..8c5ee4121 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreAggregateReRouteRepository.cs
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreAggregateReRouteRepository.cs
@@ -17,23 +17,25 @@ namespace LINGYUN.ApiGateway.Ocelot
public async Task AggregateReRouteNameExistsAsync(string name)
{
- return await DbSet.AnyAsync(ar => ar.Name.Equals(name));
+ return await (await GetDbSetAsync()).AnyAsync(ar => ar.Name.Equals(name));
}
public async Task GetByRouteIdAsync(long routeId)
{
- return await WithDetails().Where(ar => ar.ReRouteId.Equals(routeId)).FirstOrDefaultAsync();
+ return await (await WithDetailsAsync())
+ .Where(ar => ar.ReRouteId.Equals(routeId)).FirstOrDefaultAsync();
}
public async Task> GetByAppIdAsync(string appId)
{
- return await WithDetails().Where(ar => ar.AppId.Equals(appId)).ToListAsync();
+ return await (await WithDetailsAsync())
+ .Where(ar => ar.AppId.Equals(appId)).ToListAsync();
}
public async Task<(List routes, long total)> GetPagedListAsync(string appId, string filter = "",
string sorting = "", int skipCount = 1, int maxResultCount = 100)
{
- var resultReRoutes = await WithDetails()
+ var resultReRoutes = await (await WithDetailsAsync())
.Where(ar => ar.AppId.Equals(appId))
.WhereIf(!filter.IsNullOrWhiteSpace(), ar => ar.ReRouteKeys.Contains(filter) ||
ar.UpstreamHost.Contains(filter) || ar.UpstreamPathTemplate.Contains(filter))
@@ -41,7 +43,7 @@ namespace LINGYUN.ApiGateway.Ocelot
.EfPageBy(skipCount, maxResultCount)
.ToListAsync();
- var total = await GetQueryable()
+ var total = await (await GetQueryableAsync())
.Where(ar => ar.AppId.Equals(appId))
.WhereIf(!filter.IsNullOrWhiteSpace(), ar => ar.ReRouteKeys.Contains(filter) ||
ar.UpstreamHost.Contains(filter) || ar.UpstreamPathTemplate.Contains(filter)).LongCountAsync();
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreDynamicReRouteRepository.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreDynamicReRouteRepository.cs
index f8afc828b..ffa1a3cfa 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreDynamicReRouteRepository.cs
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreDynamicReRouteRepository.cs
@@ -17,12 +17,17 @@ namespace LINGYUN.ApiGateway.Ocelot
public async Task GetByItemIdAsync(int itemId)
{
- return await GetQueryable().Where(x => x.DynamicReRouteId.Equals(itemId)).FirstOrDefaultAsync();
+ return await (await GetQueryableAsync()).Where(x => x.DynamicReRouteId.Equals(itemId)).FirstOrDefaultAsync();
}
public async Task> GetByAppIdAsync(string appId)
{
- return await WithDetails().Where(x => x.AppId.Equals(appId)).ToListAsync();
+ return await (await WithDetailsAsync()).Where(x => x.AppId.Equals(appId)).ToListAsync();
+ }
+
+ public override async Task> WithDetailsAsync()
+ {
+ return await WithDetailsAsync(x => x.RateLimitRule); ;
}
public override IQueryable WithDetails()
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreGlobalConfigRepository.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreGlobalConfigRepository.cs
index afbb87ea1..a721da01c 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreGlobalConfigRepository.cs
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreGlobalConfigRepository.cs
@@ -19,7 +19,7 @@ namespace LINGYUN.ApiGateway.Ocelot
public async Task GetByItemIdAsync(long itemId)
{
- var globalConfiguration = await WithDetails().Where(x => x.ItemId.Equals(itemId)).FirstOrDefaultAsync();
+ var globalConfiguration = await (await WithDetailsAsync()).Where(x => x.ItemId.Equals(itemId)).FirstOrDefaultAsync();
if(globalConfiguration == null)
{
throw new EntityNotFoundException(typeof(GlobalConfiguration));
@@ -29,7 +29,7 @@ namespace LINGYUN.ApiGateway.Ocelot
public async Task GetByAppIdAsync(string appId)
{
- return await WithDetails()
+ return await (await WithDetailsAsync())
.Where(g => g.AppId.Equals(appId))
.FirstOrDefaultAsync();
}
@@ -37,13 +37,13 @@ namespace LINGYUN.ApiGateway.Ocelot
public virtual async Task<(List Globals, long TotalCount)> GetPagedListAsync(string filter = "", string sorting = "",
int skipCount = 1, int maxResultCount = 10)
{
- var globals = await WithDetails()
+ var globals = await (await WithDetailsAsync())
.WhereIf(!filter.IsNullOrWhiteSpace(), g => g.AppId.Contains(filter) ||
g.BaseUrl.Contains(filter) || g.DownstreamScheme.Contains(filter))
.OrderBy(g => sorting ?? g.BaseUrl)
.EfPageBy(skipCount, maxResultCount)
.ToListAsync();
- var total = await GetQueryable()
+ var total = await (await GetQueryableAsync())
.WhereIf(!filter.IsNullOrWhiteSpace(), g => g.AppId.Contains(filter) ||
g.BaseUrl.Contains(filter) || g.DownstreamScheme.Contains(filter))
.LongCountAsync();
@@ -51,6 +51,16 @@ namespace LINGYUN.ApiGateway.Ocelot
return ValueTuple.Create(globals, total);
}
+ public override async Task> WithDetailsAsync()
+ {
+ return await WithDetailsAsync(
+ x => x.HttpHandlerOptions,
+ x => x.LoadBalancerOptions,
+ x => x.QoSOptions,
+ x => x.RateLimitOptions,
+ x => x.ServiceDiscoveryProvider);
+ }
+
public override IQueryable WithDetails()
{
return WithDetails(
diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreReRouteRepository.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreReRouteRepository.cs
index 116374712..f3c4df428 100644
--- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreReRouteRepository.cs
+++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/Ocelot/EfCoreReRouteRepository.cs
@@ -19,19 +19,19 @@ namespace LINGYUN.ApiGateway.Ocelot
public async Task GetByNameAsync(string routeName)
{
- var reRoute = await WithDetails().Where(x => x.ReRouteName.Equals(routeName)).FirstOrDefaultAsync();
+ var reRoute = await (await WithDetailsAsync()).Where(x => x.ReRouteName.Equals(routeName)).FirstOrDefaultAsync();
return reRoute ?? throw new EntityNotFoundException(typeof(ReRoute), routeName);
}
public async Task GetByReRouteIdAsync(long routeId)
{
- var reRoute = await WithDetails().Where(x => x.ReRouteId.Equals(routeId)).FirstOrDefaultAsync();
+ var reRoute = await (await WithDetailsAsync()).Where(x => x.ReRouteId.Equals(routeId)).FirstOrDefaultAsync();
return reRoute ?? throw new EntityNotFoundException(typeof(ReRoute), routeId);
}
public async Task> GetByAppIdAsync(string appId)
{
- return await WithDetails()
+ return await (await WithDetailsAsync())
.Where(r => r.AppId.Equals(appId))
.ToListAsync();
}
@@ -39,7 +39,7 @@ namespace LINGYUN.ApiGateway.Ocelot
public async Task<(List routes, long total)> GetPagedListAsync(string appId, string filter = "",
string sorting = "", int skipCount = 1, int maxResultCount = 100)
{
- var resultReRoutes = await WithDetails()
+ var resultReRoutes = await (await WithDetailsAsync())
.Where(r => r.AppId.Equals(appId))
.WhereIf(!filter.IsNullOrWhiteSpace(), r => r.ReRouteName.Contains(filter) ||
r.DownstreamHostAndPorts.Contains(filter) || r.ServiceName.Contains(filter))
@@ -47,7 +47,7 @@ namespace LINGYUN.ApiGateway.Ocelot
.EfPageBy(skipCount, maxResultCount)
.ToListAsync();
- var total = await GetQueryable()
+ var total = await (await GetQueryableAsync())
.Where(r => r.AppId.Equals(appId))
.WhereIf(!filter.IsNullOrWhiteSpace(), r => r.ReRouteName.Contains(filter) ||
r.DownstreamHostAndPorts.Contains(filter) || r.ServiceName.Contains(filter))
@@ -58,20 +58,21 @@ namespace LINGYUN.ApiGateway.Ocelot
public async Task RemoveAsync(CancellationToken cancellationToken = default(CancellationToken))
{
- var entityType = DbContext.Model.FindEntityType(typeof(ReRoute));
+ var dbContext = await GetDbContextAsync();
+ var entityType = dbContext.Model.FindEntityType(typeof(ReRoute));
var tableName = entityType.GetTableName();//.Relational().TableName;
var sqlText = $"DELETE FROM @tableName";
var sqlParam = new List