Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. public interface ICommand
  2.  
  3. public interface ICreateCommand<TDto> : where TDto is IDto
  4.  
  5. public CreateUserCommand : ICreateCommand<UserDto>
  6.  
  7. public CreateCommandValidator<TDto> : AbstractValidator<ICreateCommand<TDto>>
  8.  
  9. var assembly = typeof(CommandModule)
  10. .GetTypeInfo()
  11. .Assembly;
  12.  
  13. builder.RegisterAssemblyTypes(assembly)
  14. .AsClosedTypesOf(typeof(ICommandHandler<>))
  15. .InstancePerLifetimeScope();
  16.  
  17. builder.RegisterType<CommandDispatcher>()
  18. .As<ICommandDispatcher>()
  19. .InstancePerLifetimeScope();
  20.  
  21. libraryAssembly = typeof(ICommand)
  22. .GetTypeInfo()
  23. .Assembly;
  24.  
  25. builder.RegisterAssemblyTypes(libraryAssembly)
  26. .Where(x => x.IsAssignableTo<ICommand>())
  27. .AsImplementedInterfaces();
  28.  
  29. builder.RegisterAssemblyTypes(libraryAssembly )
  30. .AsClosedTypesOf(typeof(IValidator<>))
  31. .InstancePerLifetimeScope();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement