Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface ICommand
- public interface ICreateCommand<TDto> : where TDto is IDto
- public CreateUserCommand : ICreateCommand<UserDto>
- public CreateCommandValidator<TDto> : AbstractValidator<ICreateCommand<TDto>>
- var assembly = typeof(CommandModule)
- .GetTypeInfo()
- .Assembly;
- builder.RegisterAssemblyTypes(assembly)
- .AsClosedTypesOf(typeof(ICommandHandler<>))
- .InstancePerLifetimeScope();
- builder.RegisterType<CommandDispatcher>()
- .As<ICommandDispatcher>()
- .InstancePerLifetimeScope();
- libraryAssembly = typeof(ICommand)
- .GetTypeInfo()
- .Assembly;
- builder.RegisterAssemblyTypes(libraryAssembly)
- .Where(x => x.IsAssignableTo<ICommand>())
- .AsImplementedInterfaces();
- builder.RegisterAssemblyTypes(libraryAssembly )
- .AsClosedTypesOf(typeof(IValidator<>))
- .InstancePerLifetimeScope();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement