本文整理汇总了C#中ActivityContext.ThrowIfDisposed方法的典型用法代码示例。如果您正苦于以下问题:C# ActivityContext.ThrowIfDisposed方法的具体用法?C# ActivityContext.ThrowIfDisposed怎么用?C# ActivityContext.ThrowIfDisposed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActivityContext
的用法示例。
在下文中一共展示了ActivityContext.ThrowIfDisposed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLocation
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;
}
示例2: ValidateAccessor
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: GetCurrentTransactionCore
Transaction GetCurrentTransactionCore(ActivityContext context)
{
if (context == null)
{
throw FxTrace.Exception.ArgumentNull("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;
}
示例4: GetCurrentTransactionCore
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;
}