Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Activities / System / ServiceModel / Activities / Tracking / DefaultProfileManager.cs / 1305376 / DefaultProfileManager.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Activities.Tracking { using System.Runtime.Remoting.Messaging; using System.Runtime; using System.Activities.Tracking; using System.Collections.Specialized; using System.Collections.ObjectModel; using System.Configuration; using System.ServiceModel.Configuration; using System.ServiceModel.Activities.Tracking.Configuration; class DefaultProfileManager : TrackingProfileManager { ConfigFileProfileStore profileStore; public DefaultProfileManager() { } ConfigFileProfileStore ProfileStore { get { if (this.profileStore == null) { this.profileStore = new ConfigFileProfileStore(); } return this.profileStore; } } public override TrackingProfile Load(string profileName, string activityDefinitionId, TimeSpan timeout) { if (profileName == null) { throw FxTrace.Exception.ArgumentNull("profileName"); } return this.GetProfile(profileName, activityDefinitionId); } internal TrackingProfile GetProfile(string profileName, string activityDefinitionId) { // Get all profiles from the store Collectionprofiles = this.ProfileStore.ReadProfiles(); TrackingProfile bestMatch = null; if (profiles != null) { // Go through all the profiles in the data store and find a match to the requested profile foreach (TrackingProfile profile in profiles) { // Check the profile matches the requested name, and scope type if (string.Compare(profileName, profile.Name, StringComparison.OrdinalIgnoreCase) == 0) { // If we find a global scope profile, use it as the default profile if (string.Compare("*", profile.ActivityDefinitionId, StringComparison.OrdinalIgnoreCase) == 0) { if (bestMatch == null) { bestMatch = profile; } } else if (string.Compare(activityDefinitionId, profile.ActivityDefinitionId, StringComparison.OrdinalIgnoreCase) == 0) { //specific profile for scopetarget found. bestMatch = profile; break; } } } } if (bestMatch == null) { //Add a trace message indicating tracking profile with activity definiton id is not found if (TD.TrackingProfileNotFoundIsEnabled()) { TD.TrackingProfileNotFound(profileName, activityDefinitionId); } //If the profile is not found in config, return an empty profile to suppress //events. If .config does not have profiles, return null. bestMatch = new TrackingProfile() { ActivityDefinitionId = activityDefinitionId }; } return bestMatch; } class ConfigFileProfileStore { Collection trackingProfiles; public Collection ReadProfiles() { if (this.trackingProfiles != null) { return this.trackingProfiles; } TrackingSection trackingSection = null; try { trackingSection = (TrackingSection)ConfigurationHelpers.GetSection(ConfigurationHelpers.GetSectionPath(TrackingConfigurationStrings.Tracking)); } catch (ConfigurationErrorsException e) { if (!Fx.IsFatal(e)) { FxTrace.Exception.TraceUnhandledException(e); } throw; } if (trackingSection == null) { return null; } // Configuration elements are never null, collections are empty // and single elements are constructed with the property IsPresent=false this.trackingProfiles = new Collection (); foreach (ProfileElement profileElement in trackingSection.Profiles) { if (profileElement.Workflows != null) { foreach (ProfileWorkflowElement workflowElement in profileElement.Workflows) { TrackingProfile profile = new TrackingProfile() { Name = profileElement.Name, ImplementationVisibility = profileElement.ImplementationVisibility, ActivityDefinitionId = workflowElement.ActivityDefinitionId }; workflowElement.AddQueries(profile.Queries); this.trackingProfiles.Add(profile); } } } return this.trackingProfiles; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DeviceContexts.cs
- CodeDomComponentSerializationService.cs
- LookupNode.cs
- ConsumerConnectionPointCollection.cs
- WpfPayload.cs
- RuntimeConfigurationRecord.cs
- AsyncMethodInvoker.cs
- StyleBamlTreeBuilder.cs
- Nullable.cs
- StylusPointPropertyUnit.cs
- BindingOperations.cs
- ClientCredentialsSecurityTokenManager.cs
- ZipIOLocalFileHeader.cs
- IPAddressCollection.cs
- mediaeventshelper.cs
- LocalizabilityAttribute.cs
- RegexFCD.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- AnimationException.cs
- AssemblyUtil.cs
- DataBindingCollection.cs
- SourceElementsCollection.cs
- SafeNativeMethods.cs
- XmlWriterDelegator.cs
- BitmapVisualManager.cs
- UrlMappingsModule.cs
- RemotingConfigParser.cs
- BookmarkTable.cs
- FixedTextContainer.cs
- CoreSwitches.cs
- CustomError.cs
- GeometryCollection.cs
- WebPartVerbCollection.cs
- XmlLanguageConverter.cs
- CookielessHelper.cs
- HostingEnvironment.cs
- XmlCharType.cs
- UseAttributeSetsAction.cs
- XmlWriterTraceListener.cs
- SqlIdentifier.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- InfiniteTimeSpanConverter.cs
- PeerConnector.cs
- CardSpaceException.cs
- StateMachine.cs
- ConsumerConnectionPointCollection.cs
- ContractType.cs
- BamlTreeUpdater.cs
- WindowsIPAddress.cs
- RecommendedAsConfigurableAttribute.cs
- ActivityExecutorSurrogate.cs
- ReadOnlyMetadataCollection.cs
- GridViewAutomationPeer.cs
- ClientTargetSection.cs
- FixedDSBuilder.cs
- SerializationTrace.cs
- InputLanguageCollection.cs
- UIntPtr.cs
- COM2TypeInfoProcessor.cs
- categoryentry.cs
- Types.cs
- SqlConnectionHelper.cs
- DatagridviewDisplayedBandsData.cs
- CompositeFontParser.cs
- TraversalRequest.cs
- UserValidatedEventArgs.cs
- SponsorHelper.cs
- XmlSchemaExporter.cs
- SafeNativeMethods.cs
- AssemblyAttributes.cs
- DataGridHelper.cs
- ListComponentEditorPage.cs
- TextSelection.cs
- DispatcherEventArgs.cs
- EntityContainerEmitter.cs
- WindowsFormsHostPropertyMap.cs
- Module.cs
- Encoding.cs
- UpDownEvent.cs
- RangeEnumerable.cs
- SQLConvert.cs
- QueryIntervalOp.cs
- DateTimeUtil.cs
- SettingsPropertyCollection.cs
- SafeNativeMethodsMilCoreApi.cs
- ExceptionHandlersDesigner.cs
- BufferedWebEventProvider.cs
- Intellisense.cs
- MessageDesigner.cs
- ClonableStack.cs
- StickyNote.cs
- glyphs.cs
- GroupBox.cs
- RouteItem.cs
- SafeBitVector32.cs
- RecipientInfo.cs
- PackageRelationshipCollection.cs
- CornerRadius.cs
- CompilerGlobalScopeAttribute.cs
- CurrentChangingEventManager.cs