private static TResult ConvertType <TResult>(MahuaCommandResult crossDomainCommandResult) { var json = GlobalCache.JavaScriptSerializer.Serialize(crossDomainCommandResult); var re = GlobalCache.JavaScriptSerializer.Deserialize <TResult>(json); return(re); }
public void SendCommandWithResult(MahuaCommand command, out MahuaCommandResult mahuaCommandResult) { WriteDiagnostics(() => command); using (var beginLifetimeScope = _container.BeginLifetimeScope()) { SetContainer(beginLifetimeScope); var center = beginLifetimeScope.Resolve <ICommandCenter>(); center.Handle(command, out mahuaCommandResult); var re = mahuaCommandResult; WriteDiagnostics(() => re); } }
void ICommandCenter.Handle(MahuaCommand command, out MahuaCommandResult mahuaCommandResult) { var commandHandlers = _resultCommandHandlers.FirstOrDefault(x => x.CanHandle(command)); mahuaCommandResult = (MahuaCommandResult)commandHandlers?.Handle(command); }