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
- TripleDES.cs
- Container.cs
- CheckBoxPopupAdapter.cs
- GraphicsState.cs
- ToolStripRenderer.cs
- DCSafeHandle.cs
- Regex.cs
- PrintPageEvent.cs
- Hashtable.cs
- WsatAdminException.cs
- Models.cs
- TextDpi.cs
- DeploymentSectionCache.cs
- BoundColumn.cs
- CodeTypeParameter.cs
- DataGridPageChangedEventArgs.cs
- AsyncInvokeContext.cs
- OverlappedAsyncResult.cs
- ImageButton.cs
- OleDbDataReader.cs
- KnownColorTable.cs
- WebHttpDispatchOperationSelector.cs
- QueryFunctions.cs
- ColorConvertedBitmapExtension.cs
- ExpressionBuilder.cs
- FrameworkRichTextComposition.cs
- PasswordRecovery.cs
- CorrelationResolver.cs
- HwndProxyElementProvider.cs
- OletxVolatileEnlistment.cs
- xml.cs
- OptimizedTemplateContentHelper.cs
- TailPinnedEventArgs.cs
- PointCollectionConverter.cs
- RawStylusInputCustomData.cs
- ConvertBinder.cs
- LineProperties.cs
- DetailsViewRow.cs
- ExtendedPropertyCollection.cs
- BuildManagerHost.cs
- WebServiceHostFactory.cs
- TypeToken.cs
- FocusTracker.cs
- RowType.cs
- NumericUpDown.cs
- Nullable.cs
- ProxyWebPartConnectionCollection.cs
- safelinkcollection.cs
- UidPropertyAttribute.cs
- OleDbPropertySetGuid.cs
- Journaling.cs
- CalloutQueueItem.cs
- MethodSet.cs
- PointConverter.cs
- Listbox.cs
- BCLDebug.cs
- AssemblyLoader.cs
- GridEntryCollection.cs
- LockCookie.cs
- WorkflowMarkupElementEventArgs.cs
- ExternalException.cs
- URLAttribute.cs
- BrowserCapabilitiesFactory.cs
- ArraySortHelper.cs
- Int32Converter.cs
- AsnEncodedData.cs
- Rijndael.cs
- ChtmlFormAdapter.cs
- EventHandlersStore.cs
- ParseNumbers.cs
- Line.cs
- SqlException.cs
- ClientData.cs
- _Rfc2616CacheValidators.cs
- OdbcErrorCollection.cs
- PresentationAppDomainManager.cs
- ExtractorMetadata.cs
- IsolatedStorageFileStream.cs
- SerializationFieldInfo.cs
- HWStack.cs
- DiscardableAttribute.cs
- ADConnectionHelper.cs
- ConfigXmlCDataSection.cs
- ObjectDataSource.cs
- Table.cs
- TypeDescriptor.cs
- EnterpriseServicesHelper.cs
- CachedCompositeFamily.cs
- Action.cs
- HttpListenerContext.cs
- SecurityTokenParameters.cs
- ReflectionServiceProvider.cs
- PanningMessageFilter.cs
- BitmapEffectOutputConnector.cs
- TextModifier.cs
- RichTextBoxConstants.cs
- DesignerActionMethodItem.cs
- SiteMapNodeItem.cs
- OverflowException.cs
- LinqMaximalSubtreeNominator.cs