private void PerformOperation(IStore requestStore, IStore responseStore) { Condition.Requires(requestStore).IsNotNull(); Condition.Requires(responseStore).IsNotNull(); var req = requestStore.Get <OperationArg>(this.Id); TArg reqObj = (TArg)req.Data; try { LogicOfTo <TArg, TResult> logic = (LogicOfTo <TArg, TResult>) this.OperationLogic; var respLogic = logic.Perform(reqObj) as LogicOfTo <TArg, TResult>; responseStore.SaveItem(OperationResult.New(this.Id, respLogic.Result)); } catch (Exception ex) { responseStore.SaveItem(OperationError.New(this.Id, ex)); } }
public static OperationError New(string operationName, Exception error) { OperationError item = new OperationError(operationName, error); return(item); }