Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Activities / System / ServiceModel / Activities / Description / EtwTrackingBehavior.cs / 1305376 / EtwTrackingBehavior.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.ServiceModel.Activities.Description
{
using System.Activities.Tracking;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Runtime;
using System.ServiceModel.Activation;
using System.ServiceModel.Activities.Tracking;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
[Fx.Tag.XamlVisible(false)]
public class EtwTrackingBehavior : IServiceBehavior
{
public EtwTrackingBehavior()
{
}
public string ProfileName
{
get;
set;
}
public virtual void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection endpoints, BindingParameterCollection bindingParameters)
{
}
public virtual void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
{
WorkflowServiceHost workflowServiceHost = serviceHostBase as WorkflowServiceHost;
if (null != workflowServiceHost)
{
string workflowDisplayName = workflowServiceHost.Activity.DisplayName;
string hostReference = string.Empty;
if (AspNetEnvironment.Enabled)
{
VirtualPathExtension virtualPathExtension = serviceHostBase.Extensions.Find();
if (virtualPathExtension != null && virtualPathExtension.VirtualPath != null)
{
//Format Website name\Application Virtual Path|\relative service virtual path|serviceName
string name = serviceDescription != null ? serviceDescription.Name : string.Empty;
string application = virtualPathExtension.ApplicationVirtualPath;
//If the application is the root, do not include it in servicePath
string servicePath = virtualPathExtension.VirtualPath.Replace("~", application + "|");
hostReference = string.Format(CultureInfo.InvariantCulture, "{0}{1}|{2}", virtualPathExtension.SiteName, servicePath, name);
}
}
TrackingProfile trackingProfile = this.GetProfile(this.ProfileName, workflowDisplayName);
workflowServiceHost.WorkflowExtensions.Add(
() => new EtwTrackingParticipant
{
ApplicationReference = hostReference,
TrackingProfile = trackingProfile
});
}
}
public virtual void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
{
}
TrackingProfile GetProfile(string profileName, string displayName)
{
DefaultProfileManager profileManager = new DefaultProfileManager();
return profileManager.GetProfile(profileName, displayName);
}
}
}
// 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
- TempEnvironment.cs
- QilIterator.cs
- SingleAnimation.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- Label.cs
- Fonts.cs
- XNodeNavigator.cs
- _FixedSizeReader.cs
- XmlSerializerVersionAttribute.cs
- TdsParserSessionPool.cs
- SafeHandle.cs
- ListBindingConverter.cs
- InternalResources.cs
- ControlAdapter.cs
- TagPrefixCollection.cs
- MatrixIndependentAnimationStorage.cs
- CapacityStreamGeometryContext.cs
- DSASignatureDeformatter.cs
- DbDeleteCommandTree.cs
- RecognizerInfo.cs
- DifferencingCollection.cs
- PreservationFileWriter.cs
- MessageBox.cs
- InvokeProviderWrapper.cs
- Run.cs
- DirectoryLocalQuery.cs
- ConstantSlot.cs
- DragDrop.cs
- ReadOnlyDataSource.cs
- ComplexTypeEmitter.cs
- XamlClipboardData.cs
- DataBindingHandlerAttribute.cs
- IOThreadTimer.cs
- XPathDocumentNavigator.cs
- WorkItem.cs
- ColorBlend.cs
- DecimalAnimationUsingKeyFrames.cs
- TypeDependencyAttribute.cs
- SrgsNameValueTag.cs
- DataServiceProviderMethods.cs
- ZipIOCentralDirectoryBlock.cs
- TaskFileService.cs
- Helpers.cs
- Duration.cs
- BidOverLoads.cs
- DBConnectionString.cs
- DocumentOrderQuery.cs
- WinCategoryAttribute.cs
- ConfigurationSettings.cs
- ExtensionSimplifierMarkupObject.cs
- KeyEventArgs.cs
- EncryptedReference.cs
- TransformerTypeCollection.cs
- BindingCollection.cs
- XmlIncludeAttribute.cs
- HtmlTernaryTree.cs
- X509Certificate2Collection.cs
- ListViewGroup.cs
- EntityExpressionVisitor.cs
- DataGridColumnCollection.cs
- x509store.cs
- PagesChangedEventArgs.cs
- DBSchemaRow.cs
- ObjectIDGenerator.cs
- GestureRecognitionResult.cs
- CodeTypeDeclaration.cs
- RowsCopiedEventArgs.cs
- SectionVisual.cs
- ToolboxComponentsCreatingEventArgs.cs
- ListControlDataBindingHandler.cs
- WebEventTraceProvider.cs
- ResourceProviderFactory.cs
- SamlConditions.cs
- HttpRuntimeSection.cs
- BaseValidatorDesigner.cs
- ListViewDeleteEventArgs.cs
- Exceptions.cs
- OdbcStatementHandle.cs
- ObjectListCommandCollection.cs
- DataGridViewCellEventArgs.cs
- SendMailErrorEventArgs.cs
- Animatable.cs
- ExceptionHandlers.cs
- BaseUriHelper.cs
- Ipv6Element.cs
- UnmanagedMemoryStreamWrapper.cs
- LookupBindingPropertiesAttribute.cs
- StyleXamlTreeBuilder.cs
- NameValueConfigurationElement.cs
- AnonymousIdentificationModule.cs
- AuthenticationConfig.cs
- DragDrop.cs
- EmissiveMaterial.cs
- SectionXmlInfo.cs
- RegexWorker.cs
- DiffuseMaterial.cs
- WindowsPrincipal.cs
- ObjectCloneHelper.cs
- TreeViewItem.cs
- namescope.cs