|
|
@ -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<,>)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |