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
- ClientCultureInfo.cs
- VisualProxy.cs
- SettingsSavedEventArgs.cs
- Trace.cs
- ELinqQueryState.cs
- StringUtil.cs
- ClientRoleProvider.cs
- SafeArrayTypeMismatchException.cs
- XsltSettings.cs
- EventLogEntry.cs
- EventNotify.cs
- PathData.cs
- ContractAdapter.cs
- keycontainerpermission.cs
- Single.cs
- SymmetricCryptoHandle.cs
- FrameworkRichTextComposition.cs
- TextTreeRootTextBlock.cs
- DesignerVerbCollection.cs
- DataTableReader.cs
- Permission.cs
- HtmlUtf8RawTextWriter.cs
- TextTreeFixupNode.cs
- XLinq.cs
- Group.cs
- FileSystemEventArgs.cs
- followingsibling.cs
- PenContext.cs
- TreeWalkHelper.cs
- IUnknownConstantAttribute.cs
- UnionCodeGroup.cs
- ObjectView.cs
- ServiceHostingEnvironmentSection.cs
- WebConfigManager.cs
- Roles.cs
- SchemaMapping.cs
- HyperLink.cs
- FontStretch.cs
- WsdlBuildProvider.cs
- _ChunkParse.cs
- Ref.cs
- InternalResources.cs
- TableHeaderCell.cs
- JournalEntryStack.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- CodeDOMUtility.cs
- AnonymousIdentificationSection.cs
- List.cs
- WizardForm.cs
- XmlElement.cs
- CharStorage.cs
- TextComposition.cs
- KoreanCalendar.cs
- CacheOutputQuery.cs
- BinaryObjectWriter.cs
- ConstraintConverter.cs
- MulticastIPAddressInformationCollection.cs
- Route.cs
- StreamWithDictionary.cs
- coordinatorfactory.cs
- Point3DConverter.cs
- BindUriHelper.cs
- BadImageFormatException.cs
- DrawListViewItemEventArgs.cs
- ValidationErrorCollection.cs
- DynamicRenderer.cs
- OptimizedTemplateContent.cs
- SchemaMerger.cs
- BaseAppDomainProtocolHandler.cs
- WeakHashtable.cs
- DataObjectSettingDataEventArgs.cs
- TransferRequestHandler.cs
- DynamicRenderer.cs
- PreservationFileReader.cs
- TypeConverterValueSerializer.cs
- GradientStop.cs
- ManipulationStartingEventArgs.cs
- ObjectView.cs
- DataGridViewColumnEventArgs.cs
- ReflectionHelper.cs
- Attributes.cs
- TemplateInstanceAttribute.cs
- SystemPens.cs
- MimeReturn.cs
- RotateTransform.cs
- ZipArchive.cs
- CapabilitiesAssignment.cs
- NamedObject.cs
- ObjectDataSourceWizardForm.cs
- XmlAnyAttributeAttribute.cs
- PointLight.cs
- CellCreator.cs
- StructuralObject.cs
- RoleGroupCollection.cs
- XmlWhitespace.cs
- LongValidatorAttribute.cs
- DnsEndPoint.cs
- Mouse.cs
- XPathDescendantIterator.cs
- BitmapEffectOutputConnector.cs