예제 #1
0
        public ValidationResult Validate(IDefineCommand command)
        {
            var     validatedType = typeof(IValidator <>).MakeGenericType(command.GetType());
            dynamic validator     = _container.GetInstance(validatedType);

            return(validator.Validate((dynamic)command));
        }
        public Task Execute(IDefineCommand command, CancellationToken cancellationToken)
        {
            var     handlerType = typeof(IHandleCommand <>).MakeGenericType(command.GetType());
            dynamic handler     = _lifetimeScope.Resolve(handlerType);

            return(handler.Handle((dynamic)command, cancellationToken));
        }
        public ValidationResult Validate(IDefineCommand command)
        {
            var     validatedType = typeof(IValidator <>).MakeGenericType(command.GetType());
            dynamic validator     = _lifetimeScope.Resolve(validatedType);

            return(validator.Validate((dynamic)command));
        }
예제 #4
0
        public Task Execute(IDefineCommand command)
        {
            var     handlerType = typeof(IHandleCommand <>).MakeGenericType(command.GetType());
            dynamic handler     = _container.GetInstance(handlerType);

            return(handler.Handle((dynamic)command));
        }
예제 #5
0
 public Task Execute(IDefineCommand command)
 {
     var handlerType = typeof(IHandleCommand<>).MakeGenericType(command.GetType());
     dynamic handler = _container.GetInstance(handlerType);
     return handler.Handle((dynamic)command);
 }