private Transaction GetCurrentTransactionCore(ActivityContext context) { if (context == null) { throw FxTrace.Exception.ArgumentNull(nameof(context)); } context.ThrowIfDisposed(); //If the transaction is a runtime transaction (i.e. an Invoke with ambient transaction case), then //we do not require that it be registered since the handle created for the root transaction is never registered. if (this.rootTransaction == null) { this.ThrowIfNotRegistered(SR.RuntimeTransactionHandleNotRegisteredAsExecutionProperty("GetCurrentTransaction")); } if (!this.isHandleInitialized) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.UnInitializedRuntimeTransactionHandle)); } if (this.SuppressTransaction) { return(null); } return(this.executor.CurrentTransaction); }
private void ValidateAccessor(ActivityContext context) { // We need to call ThrowIfDisposed explicitly since // context.Activity does not check isDisposed context.ThrowIfDisposed(); if (!object.ReferenceEquals(context.Activity, this.validAccessor)) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.InlinedLocationReferenceOnlyAccessibleByOwner(context.Activity, this.validAccessor))); } }
private Transaction GetCurrentTransactionCore(ActivityContext context) { if (context == null) { throw FxTrace.Exception.ArgumentNull("context"); } context.ThrowIfDisposed(); if (this.rootTransaction == null) { this.ThrowIfNotRegistered(System.Activities.SR.RuntimeTransactionHandleNotRegisteredAsExecutionProperty("GetCurrentTransaction")); } if (!this.isHandleInitialized) { throw FxTrace.Exception.AsError(new InvalidOperationException(System.Activities.SR.UnInitializedRuntimeTransactionHandle)); } if (this.SuppressTransaction) { return(null); } return(this.executor.CurrentTransaction); }
public override Location GetLocation(ActivityContext context) { Location location; if (context == null) { throw FxTrace.Exception.ArgumentNull("context"); } context.ThrowIfDisposed(); if (!object.ReferenceEquals(context.Activity, this.validAccessor)) { throw FxTrace.Exception.AsError(new InvalidOperationException(System.Activities.SR.InlinedLocationReferenceOnlyAccessibleByOwner(context.Activity, this.validAccessor))); } try { context.AllowChainedEnvironmentAccess = true; location = this.innerReference.GetLocation(context); } finally { context.AllowChainedEnvironmentAccess = false; } return(location); }