예제 #1
0
        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);
        }
예제 #2
0
        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)));
            }
        }
예제 #3
0
 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);
 }
예제 #4
0
        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);
        }