Aperea.Commands.CommandExecutor.Executor.Executor C# (CSharp) Метод

Executor() публичный Метод

public Executor ( Type commandType, Type handlerType ) : System
commandType System.Type
handlerType System.Type
Результат System
            public Executor(Type commandType, Type handlerType)
            {
                resultProperty = commandType.GetProperty("Result");
                if (resultProperty != null)
                {
                    var resultHandlerType = typeof (ICommandHandler<,>).MakeGenericType(commandType,
                        resultProperty.PropertyType);
                    if (resultHandlerType.IsAssignableFrom(handlerType))
                    {
                        executeResultMethod = resultHandlerType.GetMethod("Execute");
                    }
                }
                executeMethod = handlerType.GetMethod("Execute");

                if (executeResultMethod != null)
                {
                    ExecuteHandler =
                        (handler, command) =>
                            resultProperty.SetValue(command, executeResultMethod.Invoke(handler, new object[] {command}));
                }
                else
                {
                    ExecuteHandler = (handler, command) => executeMethod.Invoke(handler, new object[] {command});
                }
            }
CommandExecutor.Executor