public CommandExecutedEventArgs(ulong entryId, Command command, DateTime executed, TimeSpan executionTime) { JournalEntryId = entryId; Command = command; StartTime = executed; Duration = executionTime; }
public override object ExecuteCommand(Command command) { object result = null; try { Model modelOut = null; if (command is IImmutabilityCommand) { var typedCommand = command as IImmutabilityCommand; modelOut = typedCommand.Execute(_model); } else if (command is IImmutabilityCommandWithResult) { var typedCommand = command as IImmutabilityCommandWithResult; var tuple = typedCommand.Execute(_model); UnpackTuple(tuple, out modelOut, out result); } else throw new InvalidOperationException("Command type not supported by this kernel"); if (modelOut == null) throw new InvalidOperationException("Command returned null model"); _model = modelOut; return result; } catch (Exception ex) { throw new CommandAbortedException("Command failed, see inner exception for details", ex); } }
public CommandExecutedEventArgs(ulong entryId, Command command, DateTime executed, TimeSpan executionTime, IEnumerable<IEvent> events) { JournalEntryId = entryId; Command = command; StartTime = executed; Duration = executionTime; Events = events.ToArray(); }
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(); } }
/// <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); }
internal override void Apply(ref Command command) { if (!HasIsolationAttribute(command, IsolationLevel.Input) && ! command.GetType().HasImmutableAttribute()) command = Formatter.Clone(command); }
public CommandExecutingEventArgs(Command command) { Command = command; }
public TResult Execute <TResult>(Command <TModel, TResult> command) { return((TResult)base.Execute(command)); }
public void Execute(Command <TModel> command) { base.Execute(command); }
internal abstract void Apply(ref Command command);