internal static ServiceModelActivity CreateBoundedActivity(bool suspendCurrent) { if (!DiagnosticUtility.ShouldUseActivity) { return(null); } ServiceModelActivity activityToSuspend = ServiceModelActivity.Current; ServiceModelActivity retval = ServiceModelActivity.CreateActivity(true); if (retval != null) { retval._activity = (TransferActivity)ServiceModelActivity.BoundOperation(retval, true); retval._activity.SetPreviousServiceModelActivity(activityToSuspend); if (suspendCurrent) { retval._autoResume = true; } } if (suspendCurrent && activityToSuspend != null) { activityToSuspend.Suspend(); } return(retval); }
internal static ServiceModelActivity CreateBoundedActivity(bool suspendCurrent) { if (!DiagnosticUtility.ShouldUseActivity) { return(null); } ServiceModelActivity current = Current; ServiceModelActivity activity = CreateActivity(true); if (activity != null) { activity.activity = (TransferActivity)BoundOperation(activity, true); activity.activity.SetPreviousServiceModelActivity(current); if (suspendCurrent) { activity.autoResume = true; } } if (suspendCurrent && (current != null)) { current.Suspend(); } return(activity); }