Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / PeerValidationBehavior.cs / 1 / PeerValidationBehavior.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System.ServiceModel.Channels; using System.ServiceModel; using System.ServiceModel.Description; using System.Collections.ObjectModel; using System.Collections.Generic; class PeerValidationBehavior : IEndpointBehavior, IServiceBehavior { public static PeerValidationBehavior Instance { get { if (instance == null) instance = new PeerValidationBehavior(); return instance; } } static PeerValidationBehavior instance; PeerValidationBehavior() {} static bool IsRequestReplyContract(ContractDescription contract) { bool requestReply = false; foreach (OperationDescription operation in contract.Operations) { if (operation.Messages.Count > 1) // Request-reply { requestReply = true; break; } } return requestReply; } void IEndpointBehavior.Validate(ServiceEndpoint serviceEndpoint) { if (serviceEndpoint == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("serviceEndpoint"); ContractDescription contract = serviceEndpoint.Contract; Binding binding = serviceEndpoint.Binding; ValidateHelper(contract, binding); } void IEndpointBehavior.AddBindingParameters(ServiceEndpoint serviceEndpoint, BindingParameterCollection bindingParameters) { } void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, EndpointDispatcher endpointDispatcher) { } void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior) { } void IServiceBehavior.AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, Collectionendpoints, BindingParameterCollection parameters) { } void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase) { } void IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase) { if (description == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description"); for (int i = 0; i < description.Endpoints.Count; i++) { ServiceEndpoint endpoint = description.Endpoints[i]; ValidateHelper(endpoint.Contract, endpoint.Binding); } } // SM doesn't support request-reply message pattern over multi-point channels correctly, so, disabling // request-reply for NetPeerTcpBinding. (Advanced users may find a way to implement request-reply over // a CustomBinding that includes PeerTransportBE.) void ValidateHelper(ContractDescription contract, Binding binding) { if (binding is NetPeerTcpBinding && IsRequestReplyContract(contract)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException( SR.GetString(SR.BindingDoesnTSupportRequestReplyButContract1, binding.Name))); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextTreeFixupNode.cs
- LinearKeyFrames.cs
- XmlSchemaChoice.cs
- MemberMaps.cs
- CorrelationQueryBehavior.cs
- ByteConverter.cs
- ListChangedEventArgs.cs
- AssociationType.cs
- EqualityComparer.cs
- TextWriterEngine.cs
- ToolStripSeparator.cs
- MSHTMLHost.cs
- XamlReaderHelper.cs
- ScriptResourceDefinition.cs
- DecimalConstantAttribute.cs
- ExtendedPropertyCollection.cs
- NamedObject.cs
- AdornerLayer.cs
- VirtualDirectoryMapping.cs
- HttpCookie.cs
- DataGridViewAccessibleObject.cs
- DataRowCollection.cs
- BrowserDefinitionCollection.cs
- TransformCollection.cs
- CachedTypeface.cs
- ElementUtil.cs
- EnvelopedPkcs7.cs
- CodeCommentStatement.cs
- ObjectStateManagerMetadata.cs
- CodeDelegateCreateExpression.cs
- ComPlusContractBehavior.cs
- EntitySqlException.cs
- MonthChangedEventArgs.cs
- SharedHttpTransportManager.cs
- basenumberconverter.cs
- AppSecurityManager.cs
- Token.cs
- MeasureItemEvent.cs
- MergablePropertyAttribute.cs
- DefaultAuthorizationContext.cs
- MouseGestureValueSerializer.cs
- GridSplitterAutomationPeer.cs
- UpdateCompiler.cs
- BoundingRectTracker.cs
- SQLBytes.cs
- TreeWalker.cs
- ClipboardProcessor.cs
- OperatorExpressions.cs
- SpecialTypeDataContract.cs
- BitmapSizeOptions.cs
- OdbcEnvironmentHandle.cs
- ListViewSortEventArgs.cs
- ResolveRequestResponseAsyncResult.cs
- ToggleProviderWrapper.cs
- DateBoldEvent.cs
- COM2PictureConverter.cs
- SecurityDocument.cs
- AuthenticationConfig.cs
- IResourceProvider.cs
- Token.cs
- ObjectDataSource.cs
- LeftCellWrapper.cs
- DataGridViewCellStyleConverter.cs
- ProvidePropertyAttribute.cs
- ExpressionPrefixAttribute.cs
- EditorZoneBase.cs
- ComboBox.cs
- Matrix3DConverter.cs
- XmlSchemas.cs
- EdmItemCollection.cs
- CodeIterationStatement.cs
- ErrorReporting.cs
- BrowserCapabilitiesFactory35.cs
- PropertyOverridesDialog.cs
- InvalidWMPVersionException.cs
- WebServiceReceiveDesigner.cs
- DBConcurrencyException.cs
- DebuggerAttributes.cs
- basenumberconverter.cs
- DbMetaDataFactory.cs
- StrokeIntersection.cs
- SimpleWebHandlerParser.cs
- MessageSecurityProtocolFactory.cs
- ToolStripComboBox.cs
- VoiceInfo.cs
- BinaryParser.cs
- cookieexception.cs
- WebPartDescriptionCollection.cs
- HttpListenerContext.cs
- GroupQuery.cs
- __Filters.cs
- XmlText.cs
- WindowPattern.cs
- CollectionBase.cs
- TdsRecordBufferSetter.cs
- MatrixTransform.cs
- ApplicationSecurityManager.cs
- MultipleViewPattern.cs
- BulletedList.cs
- DataListItemCollection.cs