Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Activities / System / ServiceModel / Activities / Description / WorkflowServiceBehavior.cs / 1305376 / WorkflowServiceBehavior.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Activities.Description { using System.Activities; using System.ServiceModel; using System.ServiceModel.Activities.Dispatcher; using System.ServiceModel.Description; using System.ServiceModel.Dispatcher; class WorkflowServiceBehavior : IServiceBehavior { public WorkflowServiceBehavior(Activity activity) { this.Activity = activity; } public Activity Activity { get; private set; } public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collectionendpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { if (serviceDescription == null) { throw FxTrace.Exception.ArgumentNull("serviceDescription"); } if (serviceHostBase == null) { throw FxTrace.Exception.ArgumentNull("serviceHostBase"); } DurableInstanceContextProvider instanceContextProvider = new DurableInstanceContextProvider(serviceHostBase); DurableInstanceProvider instanceProvider = new DurableInstanceProvider(serviceHostBase); ServiceDebugBehavior serviceDebugBehavior = serviceDescription.Behaviors.Find (); bool includeExceptionDetailInFaults = serviceDebugBehavior != null ? serviceDebugBehavior.IncludeExceptionDetailInFaults : false; foreach (ChannelDispatcherBase channelDispatcherBase in serviceHostBase.ChannelDispatchers) { ChannelDispatcher channelDispatcher = channelDispatcherBase as ChannelDispatcher; if (channelDispatcher != null) { foreach (EndpointDispatcher endPointDispatcher in channelDispatcher.Endpoints) { if (IsWorkflowEndpoint(endPointDispatcher)) { DispatchRuntime dispatchRuntime = endPointDispatcher.DispatchRuntime; dispatchRuntime.AutomaticInputSessionShutdown = true; dispatchRuntime.ConcurrencyMode = ConcurrencyMode.Multiple; // dispatchRuntime.InstanceContextProvider = instanceContextProvider; dispatchRuntime.InstanceProvider = instanceProvider; if (includeExceptionDetailInFaults) { dispatchRuntime.SetDebugFlagInDispatchOperations(includeExceptionDetailInFaults); } } } } } } public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { if (serviceDescription == null) { throw FxTrace.Exception.ArgumentNull("serviceDescription"); } if (serviceHostBase == null) { throw FxTrace.Exception.ArgumentNull("serviceHostBase"); } } internal static bool IsWorkflowEndpoint(EndpointDispatcher endpointDispatcher) { if (endpointDispatcher.IsSystemEndpoint) { //Check whether the System Endpoint Opted in for WorkflowDispatch ServiceHostBase serviceHost = endpointDispatcher.ChannelDispatcher.Host; ServiceEndpoint serviceEndpoint = null; foreach (ServiceEndpoint endpointToMatch in serviceHost.Description.Endpoints) { if (endpointToMatch.Id == endpointDispatcher.Id) { serviceEndpoint = endpointToMatch; break; } } if (serviceEndpoint != null) { //User defined Std Endpoint with WorkflowContractBehaviorAttribute. return serviceEndpoint is WorkflowHostingEndpoint || serviceEndpoint.Contract.Behaviors.Contains(typeof(WorkflowContractBehaviorAttribute)); } return false; //Some Einstein scenario where EndpointDispatcher is added explicitly without associated ServiceEndpoint. } return true; //Application Endpoint } } } // 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
- BitmapSource.cs
- DeferredReference.cs
- DataGridViewComboBoxColumnDesigner.cs
- HierarchicalDataBoundControlAdapter.cs
- OrCondition.cs
- UInt32.cs
- NotSupportedException.cs
- PropertySourceInfo.cs
- WindowsListViewItem.cs
- HttpCookiesSection.cs
- SynchronizedDisposablePool.cs
- CustomExpression.cs
- safelink.cs
- LocatorManager.cs
- SpStreamWrapper.cs
- XmlAnyElementAttributes.cs
- SiteOfOriginContainer.cs
- JavaScriptSerializer.cs
- IISMapPath.cs
- HtmlPhoneCallAdapter.cs
- COM2EnumConverter.cs
- ImageButton.cs
- httpstaticobjectscollection.cs
- PropertyToken.cs
- TransactionChannelFactory.cs
- CodeAttributeArgument.cs
- Transform.cs
- SmiEventStream.cs
- PtsHost.cs
- httpstaticobjectscollection.cs
- SchemaManager.cs
- XmlSchemaIdentityConstraint.cs
- remotingproxy.cs
- InternalCache.cs
- SynchronizationContext.cs
- AttributeAction.cs
- IssuanceTokenProviderBase.cs
- EntityCommandExecutionException.cs
- XmlSerializerAssemblyAttribute.cs
- StatusBarPanel.cs
- SystemResources.cs
- indexingfiltermarshaler.cs
- BaseServiceProvider.cs
- CodeMemberMethod.cs
- SerializationAttributes.cs
- KeyValueConfigurationElement.cs
- DataContractFormatAttribute.cs
- InternalBase.cs
- SchemaImporterExtension.cs
- WebPartConnectionsConfigureVerb.cs
- StopRoutingHandler.cs
- SchemaImporterExtensionsSection.cs
- FilterException.cs
- PropertyIDSet.cs
- ListGeneralPage.cs
- DependencyObjectPropertyDescriptor.cs
- BindingBase.cs
- PointCollectionConverter.cs
- XmlSignificantWhitespace.cs
- ByteStack.cs
- HelpProvider.cs
- TemplateXamlTreeBuilder.cs
- ImportedNamespaceContextItem.cs
- ContractTypeNameElement.cs
- SqlRowUpdatingEvent.cs
- Classification.cs
- WorkflowRuntimeEndpoint.cs
- Int32Storage.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- BaseAddressPrefixFilterElementCollection.cs
- CompareValidator.cs
- InputReport.cs
- counter.cs
- RegexRunner.cs
- ToolStripItem.cs
- SplineKeyFrames.cs
- ObjectListFieldsPage.cs
- SecurityKeyUsage.cs
- Brush.cs
- ToolStripPanelRenderEventArgs.cs
- DesignerView.cs
- DocumentationServerProtocol.cs
- BezierSegment.cs
- WindowsStartMenu.cs
- BehaviorEditorPart.cs
- HtmlControl.cs
- SmtpTransport.cs
- Animatable.cs
- DataStorage.cs
- BinaryCommonClasses.cs
- ComponentGuaranteesAttribute.cs
- UnmanagedHandle.cs
- ThousandthOfEmRealDoubles.cs
- SectionVisual.cs
- ToolStripSystemRenderer.cs
- StructuredTypeEmitter.cs
- SignatureGenerator.cs
- WaitForChangedResult.cs
- DataGridViewImageColumn.cs
- DateTimeConverter2.cs