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
- CLRBindingWorker.cs
- PassportAuthenticationEventArgs.cs
- ProfileService.cs
- DataGridTextBoxColumn.cs
- updatecommandorderer.cs
- COM2ComponentEditor.cs
- BaseCollection.cs
- SmtpCommands.cs
- IsolatedStorageException.cs
- DbXmlEnabledProviderManifest.cs
- EntityDataSourceView.cs
- XmlAttributeOverrides.cs
- UniqueConstraint.cs
- WindowsHyperlink.cs
- ActionFrame.cs
- Exception.cs
- InstanceKeyCompleteException.cs
- Overlapped.cs
- ProviderBase.cs
- DebugView.cs
- Stack.cs
- UnicastIPAddressInformationCollection.cs
- XmlTextReaderImpl.cs
- While.cs
- JsonFormatReaderGenerator.cs
- TreeNodeMouseHoverEvent.cs
- DataSetViewSchema.cs
- DiffuseMaterial.cs
- UInt32Storage.cs
- MenuAdapter.cs
- OdbcErrorCollection.cs
- BitConverter.cs
- StartUpEventArgs.cs
- ProxyWebPart.cs
- ContentElement.cs
- LicenseManager.cs
- PropertyExpression.cs
- EdmItemCollection.cs
- ServiceKnownTypeAttribute.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- securitycriticaldataformultiplegetandset.cs
- ProxyWebPartConnectionCollection.cs
- ListDictionaryInternal.cs
- EditorPartCollection.cs
- PropertyEmitterBase.cs
- HtmlGenericControl.cs
- RuntimeVariablesExpression.cs
- FormatterConverter.cs
- ProviderException.cs
- SoapServerMessage.cs
- EFTableProvider.cs
- RootBuilder.cs
- ColorContext.cs
- ByteKeyFrameCollection.cs
- ThreadPool.cs
- Version.cs
- RsaElement.cs
- QueryAccessibilityHelpEvent.cs
- DataGridBoolColumn.cs
- ByteKeyFrameCollection.cs
- ListBindingConverter.cs
- TrackingCondition.cs
- XsdDateTime.cs
- Attributes.cs
- PartDesigner.cs
- DesignTimeTemplateParser.cs
- ActiveDocumentEvent.cs
- StyleCollection.cs
- FrameworkObject.cs
- SchemaTableColumn.cs
- ApplicationBuildProvider.cs
- UTF8Encoding.cs
- OleCmdHelper.cs
- RenamedEventArgs.cs
- SecureConversationServiceElement.cs
- SqlIdentifier.cs
- WebPartVerbCollection.cs
- PropertyGrid.cs
- EncoderParameters.cs
- DisplayMemberTemplateSelector.cs
- SmtpTransport.cs
- EnterpriseServicesHelper.cs
- ResourceAssociationTypeEnd.cs
- ComponentDispatcher.cs
- SocketInformation.cs
- EntitySqlQueryBuilder.cs
- StringAttributeCollection.cs
- baseshape.cs
- DrawingAttributeSerializer.cs
- DecimalConverter.cs
- ElementNotAvailableException.cs
- SvcMapFileLoader.cs
- ThemeInfoAttribute.cs
- TraceProvider.cs
- InputMethod.cs
- ClientCultureInfo.cs
- RoleService.cs
- VectorAnimationUsingKeyFrames.cs
- XmlDataProvider.cs
- TreeView.cs