|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Volo.Abp.DependencyInjection;
|
|
|
|
|
using Volo.Abp.Uow;
|
|
|
|
|
|
|
|
|
@ -8,17 +10,20 @@ namespace Volo.Abp.AspNetCore.Uow
|
|
|
|
|
public class AbpUnitOfWorkMiddleware : IMiddleware, ITransientDependency
|
|
|
|
|
{
|
|
|
|
|
private readonly IUnitOfWorkManager _unitOfWorkManager;
|
|
|
|
|
private readonly AbpAspNetCoreUnitOfWorkOptions _options;
|
|
|
|
|
|
|
|
|
|
public AbpUnitOfWorkMiddleware(IUnitOfWorkManager unitOfWorkManager)
|
|
|
|
|
public AbpUnitOfWorkMiddleware(
|
|
|
|
|
IUnitOfWorkManager unitOfWorkManager,
|
|
|
|
|
IOptions<AbpAspNetCoreUnitOfWorkOptions> options)
|
|
|
|
|
{
|
|
|
|
|
_unitOfWorkManager = unitOfWorkManager;
|
|
|
|
|
_options = options.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
|
|
|
|
|
{
|
|
|
|
|
//TODO: Make this configurable.
|
|
|
|
|
if (context.Request.Path.Value != null &&
|
|
|
|
|
context.Request.Path.Value.StartsWith("/_blazor"))
|
|
|
|
|
_options.IgnoredUrls.Any(x => context.Request.Path.Value.StartsWith(x)))
|
|
|
|
|
{
|
|
|
|
|
await next(context);
|
|
|
|
|
return;
|
|
|
|
|