Example #1
0
        public Result Dispatch(CommandInterface command)
        {
            Type type = typeof(CommandHandlerInterface <>);

            Type[] typeArgs           = { command.GetType() };
            Type   commandHandlerType = type.MakeGenericType(typeArgs);

            dynamic handler = _provider.GetService(commandHandlerType);
            Result  result  = handler.Handle((dynamic)command);

            return(result);
        }