MediatorR: Migration Guide 4.x to 5.0

This commit is contained in:
Erik Pique 2018-09-28 10:26:10 +02:00
parent 349d5ea3bb
commit 1fdcc5cc32
5 changed files with 10 additions and 24 deletions

View File

@ -11,7 +11,7 @@
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
<PackageReference Include="MediatR" Version="4.1.0" />
<PackageReference Include="MediatR" Version="5.1.0" />
<PackageReference Include="Moq" Version="4.8.1" />
</ItemGroup>

View File

@ -1,14 +1,12 @@
using Autofac;
using Autofac.Core;
using System.Linq;
using System.Reflection;
using Autofac;
using FluentValidation;
using MediatR;
using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
using Ordering.API.Application.DomainEventHandlers.OrderStartedEvent;
using Ordering.API.Application.Validations;
using Ordering.API.Infrastructure.Behaviors;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules
{
@ -34,26 +32,14 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
.AsImplementedInterfaces();
builder.Register<SingleInstanceFactory>(context =>
builder.Register<ServiceFactory>(context =>
{
var componentContext = context.Resolve<IComponentContext>();
return t => { object o; return componentContext.TryResolve(t, out o) ? o : null; };
});
builder.Register<MultiInstanceFactory>(context =>
{
var componentContext = context.Resolve<IComponentContext>();
return t =>
{
var resolved = (IEnumerable<object>)componentContext.Resolve(typeof(IEnumerable<>).MakeGenericType(t));
return resolved;
};
});
builder.RegisterGeneric(typeof(LoggingBehavior<,>)).As(typeof(IPipelineBehavior<,>));
builder.RegisterGeneric(typeof(ValidatorBehavior<,>)).As(typeof(IPipelineBehavior<,>));
}
}
}

View File

@ -31,7 +31,7 @@
<ItemGroup>
<PackageReference Include="FluentValidation.AspNetCore" Version="7.5.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="4.1.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="5.1.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.2.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.2.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.6.1" />
@ -40,7 +40,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
<PackageReference Include="MediatR" Version="4.1.0" />
<PackageReference Include="MediatR" Version="5.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="Dapper" Version="1.50.4" />

View File

@ -5,8 +5,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="4.0.1" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="4.0.0" />
<PackageReference Include="MediatR" Version="5.1.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="5.1.0" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.4.0" />
</ItemGroup>

View File

@ -11,7 +11,7 @@
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
<PackageReference Include="MediatR" Version="4.1.0" />
<PackageReference Include="MediatR" Version="5.1.0" />
<PackageReference Include="Moq" Version="4.8.1" />
</ItemGroup>