public Validation <IError, StoreModel> Create(StoreCreateCommand command) { // validate // create domain model var store = new Store(); // interrupt var args = new CreateArguments(); var i = new StoreCreatingInterrupterModel(store, args); //var g = storeCreateInterrupters.Aggregate(i, (model, interrupter) => InterrupterDispatcher.Dispatch(interrupter, model)); var iResult = InterrupterDispatcher.Dispatch(storeCreateInterrupters, i); if (iResult.Arguments.IsCanceled) { // TODO: return reason //Fail(args.Reason) return(null); } // call store service, in order to save it // throw async Event // return successful result return(new Validation <IError, StoreModel>()); }
public StoreCreatingInterrupterModel(Store store, CreateArguments arguments) { Store = store; Arguments = arguments; }