public override object ExecuteCommand(Command command) { try { _synchronizer.EnterUpgrade(); command.PrepareStub(_model); _synchronizer.EnterWrite(); return command.ExecuteStub(_model); } finally { _synchronizer.Exit(); } }
public override object ExecuteCommand(Command command) { try { _synchronizer.EnterUpgrade(); command.PrepareStub(_model); _synchronizer.EnterWrite(); var result = command.ExecuteStub(_model); _model.Revision++; return result; } finally { _synchronizer.Exit(); } }
public override object ExecuteCommand(Command command) { try { _synchronizer.EnterUpgrade(); command.PrepareStub(_model); _synchronizer.EnterWrite(); var result = command.ExecuteStub(_model); _model.Revision++; return(result); } finally { _synchronizer.Exit(); } }
/// <summary> /// Apply the command to the food taster. If it succeeds, apply to the real model. /// </summary> /// <param name="command"></param> /// <returns></returns> public override object ExecuteCommand(Command command) { try { command.PrepareStub(_foodTaster); command.ExecuteStub(_foodTaster); //outofmemory,commandaborted, unhandled user } catch (CommandAbortedException) { throw; } catch (OutOfMemoryException) { throw; } catch (Exception ex) { _foodTaster = _formatter.Clone(Model); //reset throw new CommandAbortedException("Royal taster died of food poisoning, see inner exception for details", ex); } return base.ExecuteCommand(command); }
/// <summary> /// Apply the command to the food taster. If it succeeds, apply to the real model. /// </summary> /// <param name="command"></param> /// <returns></returns> public override object ExecuteCommand(Command command) { try { command.PrepareStub(_foodTaster); command.ExecuteStub(_foodTaster); //outofmemory,commandaborted, unhandled user } catch (CommandAbortedException) { throw; } catch (OutOfMemoryException) { throw; } catch (Exception ex) { _foodTaster = _formatter.Clone(_model); //reset throw new CommandAbortedException("Royal taster died of food poisoning, see inner exception for details", ex); } return(base.ExecuteCommand(command)); }