static object ExecuteCommandHandler(ICommand command) { IMessageContext commandContext = new EmptyMessageContext(command); PerMessageContextLifetimeManager.CurrentMessageContext = commandContext; var commandHandler = IoCFactory.Resolve <CommunityCommandHandler>(); ((dynamic)commandHandler).Handle((dynamic)command); return(commandContext.Reply); }
public object ExecuteCommand(ICommand command) { IMessageContext commandContext = new EmptyMessageContext(command); PerMessageContextLifetimeManager.CurrentMessageContext = commandContext; var commandHandler = IoCFactory.Resolve <TCommandHanlder>(); ((dynamic)commandHandler).Handle((dynamic)command); var result = commandContext.Reply; PerMessageContextLifetimeManager.CurrentMessageContext = null; return(result); }
public object ExecuteCommand(ICommand command) { IMessageContext commandContext = new EmptyMessageContext(command); using (var scope = IoCFactory.Instance.CurrentContainer.CreateChildContainer()) { scope.RegisterInstance(typeof(IMessageContext), commandContext); var commandHandler = scope.Resolve <TCommandHanlder>(); ((dynamic)commandHandler).Handle((dynamic)command); var result = commandContext.Reply; return(result); } }