예제 #1
0
            public RuntimeTrackingProfile GetRuntimeTrackingProfile(TrackingProfile profile, Activity rootElement)
            {
                Fx.Assert(rootElement != null, "Root element must be valid");

                RuntimeTrackingProfile foundRuntimeProfile = null;
                HybridCollection <RuntimeTrackingProfile> runtimeProfileList = null;

                lock (_cache)
                {
                    if (!_cache.TryGetValue(rootElement, out runtimeProfileList))
                    {
                        foundRuntimeProfile = new RuntimeTrackingProfile(profile, rootElement);
                        runtimeProfileList  = new HybridCollection <RuntimeTrackingProfile>();
                        runtimeProfileList.Add(foundRuntimeProfile);

                        _cache.Add(rootElement, runtimeProfileList);
                    }
                    else
                    {
                        ReadOnlyCollection <RuntimeTrackingProfile> runtimeProfileCollection = runtimeProfileList.AsReadOnly();
                        foreach (RuntimeTrackingProfile runtimeProfile in runtimeProfileCollection)
                        {
                            if (string.CompareOrdinal(profile.Name, runtimeProfile._associatedProfile.Name) == 0 &&
                                string.CompareOrdinal(profile.ActivityDefinitionId, runtimeProfile._associatedProfile.ActivityDefinitionId) == 0)
                            {
                                foundRuntimeProfile = runtimeProfile;
                                break;
                            }
                        }

                        if (foundRuntimeProfile == null)
                        {
                            foundRuntimeProfile = new RuntimeTrackingProfile(profile, rootElement);
                            runtimeProfileList.Add(foundRuntimeProfile);
                        }
                    }
                }
                return(foundRuntimeProfile);
            }
예제 #2
0
        internal RuntimeTrackingProfile(TrackingProfile profile, Activity rootElement)
        {
            _associatedProfile       = profile;
            _isRootNativeActivity    = rootElement is NativeActivity;
            _trackingRecordPreFilter = new TrackingRecordPreFilter();

            foreach (TrackingQuery query in _associatedProfile.Queries)
            {
                if (query is ActivityStateQuery)
                {
                    AddActivitySubscription((ActivityStateQuery)query);
                }
                else if (query is WorkflowInstanceQuery)
                {
                    AddWorkflowSubscription((WorkflowInstanceQuery)query);
                }
                else if (query is BookmarkResumptionQuery)
                {
                    AddBookmarkSubscription((BookmarkResumptionQuery)query);
                }
                else if (query is CustomTrackingQuery)
                {
                    AddCustomTrackingSubscription((CustomTrackingQuery)query);
                }
                else if (query is ActivityScheduledQuery)
                {
                    AddActivityScheduledSubscription((ActivityScheduledQuery)query);
                }
                else if (query is CancelRequestedQuery)
                {
                    AddCancelRequestedSubscription((CancelRequestedQuery)query);
                }
                else if (query is FaultPropagationQuery)
                {
                    AddFaultPropagationSubscription((FaultPropagationQuery)query);
                }
            }
        }
예제 #3
0
 internal static RuntimeTrackingProfile GetRuntimeTrackingProfile(TrackingProfile profile, Activity rootElement)
 {
     return(RuntimeTrackingProfile.Cache.GetRuntimeTrackingProfile(profile, rootElement));
 }