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); }
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); } } }
internal static RuntimeTrackingProfile GetRuntimeTrackingProfile(TrackingProfile profile, Activity rootElement) { return(RuntimeTrackingProfile.Cache.GetRuntimeTrackingProfile(profile, rootElement)); }