Helpers.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Activities / Executors / Helpers.cs / 1305376 / Helpers.cs

                            using System; 
using System.Diagnostics;
using System.Reflection;
using System.Collections;
using System.Workflow.ComponentModel; 
using System.Workflow.Runtime;
using System.Xml; 
using System.Workflow.Activities.Common; 

namespace System.Workflow.Activities 
{
    internal static class ActivityHelpers
    {
        internal static void InitializeCorrelationTokenCollection(Activity activity, CorrelationToken correlator) 
        {
            if (correlator != null && !String.IsNullOrEmpty(correlator.OwnerActivityName)) 
            { 
                string ownerActivityId = correlator.OwnerActivityName;
                Activity owner = activity.GetActivityByName(ownerActivityId); 
                if (owner == null)
                    owner = System.Workflow.Activities.Common.Helpers.ParseActivityForBind(activity, ownerActivityId);
                if (owner == null)
                    throw new ArgumentException("ownerActivity"); 

                CorrelationTokenCollection collection = owner.GetValue(CorrelationTokenCollection.CorrelationTokenCollectionProperty) as CorrelationTokenCollection; 
                if (collection == null) 
                {
                    collection = new CorrelationTokenCollection(); 
                    owner.SetValue(CorrelationTokenCollection.CorrelationTokenCollectionProperty, collection);
                }

                if(!collection.Contains(correlator.Name)) 
                {
                    collection.Add( correlator); 
                } 
            }
        } 
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System; 
using System.Diagnostics;
using System.Reflection;
using System.Collections;
using System.Workflow.ComponentModel; 
using System.Workflow.Runtime;
using System.Xml; 
using System.Workflow.Activities.Common; 

namespace System.Workflow.Activities 
{
    internal static class ActivityHelpers
    {
        internal static void InitializeCorrelationTokenCollection(Activity activity, CorrelationToken correlator) 
        {
            if (correlator != null && !String.IsNullOrEmpty(correlator.OwnerActivityName)) 
            { 
                string ownerActivityId = correlator.OwnerActivityName;
                Activity owner = activity.GetActivityByName(ownerActivityId); 
                if (owner == null)
                    owner = System.Workflow.Activities.Common.Helpers.ParseActivityForBind(activity, ownerActivityId);
                if (owner == null)
                    throw new ArgumentException("ownerActivity"); 

                CorrelationTokenCollection collection = owner.GetValue(CorrelationTokenCollection.CorrelationTokenCollectionProperty) as CorrelationTokenCollection; 
                if (collection == null) 
                {
                    collection = new CorrelationTokenCollection(); 
                    owner.SetValue(CorrelationTokenCollection.CorrelationTokenCollectionProperty, collection);
                }

                if(!collection.Contains(correlator.Name)) 
                {
                    collection.Add( correlator); 
                } 
            }
        } 
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK