Browse Source

Register middleware with ITransientDependency.

pull/1274/head
maliming 7 years ago
parent
commit
ffe8fdf917
  1. 2
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyModule.cs
  2. 3
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs
  3. 5
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs
  4. 3
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs
  5. 3
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs
  6. 3
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs
  7. 3
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs
  8. 2
      framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
  9. 3
      framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/FakeAuthenticationMiddleware.cs

2
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/AbpAspNetCoreMultiTenancyModule.cs

@ -19,8 +19,6 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
options.TenantResolvers.Add(new HeaderTenantResolveContributor());
options.TenantResolvers.Add(new CookieTenantResolveContributor());
});
context.Services.AddTransient<MultiTenancyMiddleware>();
}
}
}

3
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs

@ -1,11 +1,12 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.AspNetCore.MultiTenancy
{
public class MultiTenancyMiddleware : IMiddleware
public class MultiTenancyMiddleware : IMiddleware, ITransientDependency
{
private readonly ITenantResolver _tenantResolver;
private readonly ITenantStore _tenantStore;

5
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs

@ -46,11 +46,6 @@ namespace Volo.Abp.AspNetCore
AddAspNetServices(context.Services);
context.Services.AddObjectAccessor<IApplicationBuilder>();
context.Services.AddTransient<AbpAuditingMiddleware>();
context.Services.AddTransient<AbpUnitOfWorkMiddleware>();
context.Services.AddTransient<AbpCorrelationIdMiddleware>();
context.Services.AddTransient<AbpExceptionHandlingMiddleware>();
}
private static void AddAspNetServices(IServiceCollection services)

3
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs

@ -3,11 +3,12 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using Volo.Abp.Auditing;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Users;
namespace Volo.Abp.AspNetCore.Auditing
{
public class AbpAuditingMiddleware : IMiddleware
public class AbpAuditingMiddleware : IMiddleware, ITransientDependency
{
private readonly IAuditingManager _auditingManager;

3
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs

@ -5,12 +5,13 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
using Volo.Abp.AspNetCore.Uow;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http;
using Volo.Abp.Json;
namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling
{
public class AbpExceptionHandlingMiddleware : IMiddleware
public class AbpExceptionHandlingMiddleware : IMiddleware, ITransientDependency
{
private readonly ILogger<AbpUnitOfWorkMiddleware> _logger;

3
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs

@ -1,11 +1,12 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Tracing;
namespace Volo.Abp.AspNetCore.Tracing
{
public class AbpCorrelationIdMiddleware : IMiddleware
public class AbpCorrelationIdMiddleware : IMiddleware, ITransientDependency
{
private readonly CorrelationIdOptions _options;
private readonly ICorrelationIdProvider _correlationIdProvider;

3
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs

@ -1,10 +1,11 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;
namespace Volo.Abp.AspNetCore.Uow
{
public class AbpUnitOfWorkMiddleware : IMiddleware
public class AbpUnitOfWorkMiddleware : IMiddleware, ITransientDependency
{
public const string UnitOfWorkReservationName = "_AbpActionUnitOfWork";

2
framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs

@ -70,8 +70,6 @@ namespace Volo.Abp.AspNetCore.Mvc
typeof(AbpValidationResource)
).AddVirtualJson("/Volo/Abp/AspNetCore/Mvc/Localization/Resource");
});
context.Services.AddTransient<FakeAuthenticationMiddleware>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

3
framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/FakeAuthenticationMiddleware.cs

@ -3,10 +3,11 @@ using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.Authorization
{
public class FakeAuthenticationMiddleware : IMiddleware
public class FakeAuthenticationMiddleware : IMiddleware, ITransientDependency
{
private readonly FakeUserClaims _fakeUserClaims;

Loading…
Cancel
Save