Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using ProverOperacoesWF.Common.CQRS.Command;
- using ProverOperacoesWF.Common.CQRS.Query;
- using ProverOperacoesWF.Common.ServiceBus;
- using ProverOperacoesWF.Common.ServiceBus.Command;
- using ProverOperacoesWF.Common.ServiceBus.Query;
- using ProverOperacoesWF.Core.Commands.Base;
- using ProverOperacoesWF.Data.Context;
- using ProverOperacoesWF.Data.Models;
- using ProverOperacoesWF.SharedKernel.Containers;
- using SimpleInjector;
- namespace ProverOperacoesWF.IoC
- {
- public static class ContainerFactory
- {
- public static Container GetContainer(ScopedLifestyle scopedLifestyle)
- {
- var container = new Container();
- container.Options.DefaultScopedLifestyle = scopedLifestyle;
- container.Register<IDataContext, ApplicationDbContext>(Lifestyle.Scoped);
- container.Register<ICommandBus, CommandBus>(Lifestyle.Scoped);
- container.Register<IQueryBus, QueryBus>(Lifestyle.Scoped);
- var coreLayerAssemblies = new[] { typeof(CommandBase).Assembly };
- container.Register(typeof(ICommandHandler<,>), coreLayerAssemblies);
- container.Register(typeof(IQueryHandler<,>), coreLayerAssemblies);
- //container.Register(typeof(IEventHandler<>), coreLayerAssemblies);
- //container.Register(typeof(IValidator<>), coreLayerAssemblies);
- ApplicationContainer.SetApplicationContainer(container);
- return container;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement