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
- ValueChangedEventManager.cs
- EventBookmark.cs
- EntityDataSourceColumn.cs
- SqlTopReducer.cs
- MasterPage.cs
- Win32SafeHandles.cs
- CallContext.cs
- DefaultBinder.cs
- ManipulationStartedEventArgs.cs
- VScrollProperties.cs
- ListChangedEventArgs.cs
- EventLog.cs
- TableItemProviderWrapper.cs
- CompoundFileReference.cs
- OdbcStatementHandle.cs
- UserPersonalizationStateInfo.cs
- Schema.cs
- ActivityMarkupSerializer.cs
- ActivationServices.cs
- NullableLongAverageAggregationOperator.cs
- ConstructorBuilder.cs
- BinaryEditor.cs
- Application.cs
- RawAppCommandInputReport.cs
- ToolStripSplitStackLayout.cs
- ImageSourceConverter.cs
- LayoutDump.cs
- GlyphRun.cs
- XmlSchemaSimpleTypeUnion.cs
- ItemCollection.cs
- PasswordRecovery.cs
- WebBrowserSiteBase.cs
- GridViewHeaderRowPresenter.cs
- DoubleCollectionValueSerializer.cs
- CodeAttributeDeclarationCollection.cs
- BasicExpressionVisitor.cs
- DBConnection.cs
- WizardStepBase.cs
- DescendentsWalkerBase.cs
- ResponseStream.cs
- InvalidateEvent.cs
- Msec.cs
- ImageListImageEditor.cs
- RowToParametersTransformer.cs
- WebAdminConfigurationHelper.cs
- ListViewGroup.cs
- itemelement.cs
- TypeNameParser.cs
- SerialReceived.cs
- FixedSOMImage.cs
- WebBrowserUriTypeConverter.cs
- RolePrincipal.cs
- HtmlControlPersistable.cs
- RoutingExtension.cs
- SchemaImporterExtensionElement.cs
- Operator.cs
- DLinqAssociationProvider.cs
- FormDesigner.cs
- MenuItem.cs
- RouteTable.cs
- DiscoveryDocumentSerializer.cs
- PropertyMapper.cs
- DoWorkEventArgs.cs
- ZipIOExtraFieldPaddingElement.cs
- CrossSiteScriptingValidation.cs
- X509AsymmetricSecurityKey.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- MailHeaderInfo.cs
- OpCodes.cs
- IdentityHolder.cs
- TraceListeners.cs
- PreservationFileWriter.cs
- ExpressionBuilderContext.cs
- DataSourceSerializationException.cs
- XmlCollation.cs
- SuppressIldasmAttribute.cs
- RenderData.cs
- AssemblyAssociatedContentFileAttribute.cs
- RowSpanVector.cs
- SecurityTokenProvider.cs
- ModelItemDictionaryImpl.cs
- PointHitTestResult.cs
- hwndwrapper.cs
- AbstractSvcMapFileLoader.cs
- MarshalDirectiveException.cs
- PopOutPanel.cs
- GeneralTransform3DTo2D.cs
- ImageMap.cs
- HierarchicalDataSourceControl.cs
- InvalidCastException.cs
- XmlQueryTypeFactory.cs
- RegexCompiler.cs
- ClientTargetSection.cs
- Error.cs
- FirewallWrapper.cs
- LinkedResourceCollection.cs
- Pkcs7Signer.cs
- SectionInformation.cs
- Panel.cs
- cryptoapiTransform.cs