public IAsyncResult BeginExecute(InstanceHandle handle, InstancePersistenceCommand command, TimeSpan timeout, AsyncCallback callback, object state) { if (command == null) { throw Fx.Exception.ArgumentNull(nameof(command)); } if (handle == null) { throw Fx.Exception.ArgumentNull(nameof(handle)); } if (!object.ReferenceEquals(this, handle.Store)) { throw Fx.Exception.Argument(nameof(handle), SR.ContextNotFromThisStore); } TimeoutHelper.ThrowIfNegativeArgument(timeout); return(InstancePersistenceContext.BeginOuterExecute(handle, command, timeout, callback, state)); }
public InstanceView Execute(InstanceHandle handle, InstancePersistenceCommand command, TimeSpan timeout) { if (command == null) { throw Fx.Exception.ArgumentNull(nameof(command)); } if (handle == null) { throw Fx.Exception.ArgumentNull(nameof(handle)); } if (!object.ReferenceEquals(this, handle.Store)) { throw Fx.Exception.Argument(nameof(handle), SR.ContextNotFromThisStore); } TimeoutHelper.ThrowIfNegativeArgument(timeout); return(InstancePersistenceContext.OuterExecute(handle, command, timeout)); }
protected internal virtual bool TryCommand(InstancePersistenceContext context, InstancePersistenceCommand command, TimeSpan timeout) { return(EndTryCommand(BeginTryCommand(context, command, timeout, null, null))); }
protected internal virtual IAsyncResult BeginTryCommand(InstancePersistenceContext context, InstancePersistenceCommand command, TimeSpan timeout, AsyncCallback callback, object state) { return(new CompletedAsyncResult <bool>(false, callback, state)); }
protected override IAsyncResult BeginTryCommand(InstancePersistenceContext context, InstancePersistenceCommand command, TimeSpan timeout, AsyncCallback callback, object state) { try { if (command is SaveWorkflowCommand) { if (delegates != null && delegates.SaveWorkflow != null) { return(new TypedCompletedAsyncResult <bool>(delegates.SaveWorkflow(context, (SaveWorkflowCommand)command), callback, state)); } return(new TypedCompletedAsyncResult <bool>(this.SaveWorkflow(context, (SaveWorkflowCommand)command), callback, state)); } else if (command is LoadWorkflowCommand) { if (delegates != null && delegates.LoadWorkflow != null) { return(new TypedCompletedAsyncResult <bool>(delegates.LoadWorkflow(context, (LoadWorkflowCommand)command), callback, state)); } return(new TypedCompletedAsyncResult <bool>(this.LoadWorkflow(context, (LoadWorkflowCommand)command), callback, state)); } else if (command is CreateWorkflowOwnerCommand) { if (delegates != null && delegates.CreateWorkflowOwner != null) { return(new TypedCompletedAsyncResult <bool>(delegates.CreateWorkflowOwner(context, (CreateWorkflowOwnerCommand)command), callback, state)); } return(new TypedCompletedAsyncResult <bool>(this.CreateWorkflowOwner(context, (CreateWorkflowOwnerCommand)command), callback, state)); } else if (command is DeleteWorkflowOwnerCommand) { if (delegates != null && delegates.DeleteWorkflowOwner != null) { return(new TypedCompletedAsyncResult <bool>(delegates.DeleteWorkflowOwner(context, (DeleteWorkflowOwnerCommand)command), callback, state)); } return(new TypedCompletedAsyncResult <bool>(this.DeleteWorkflowOwner(context, (DeleteWorkflowOwnerCommand)command), callback, state)); } return(new TypedCompletedAsyncResult <bool>(false, callback, state)); } catch (Exception e) { return(new TypedCompletedAsyncResult <Exception>(e, callback, state)); } }