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
- UserControlParser.cs
- UpdateRecord.cs
- SchemaNamespaceManager.cs
- DesignBindingEditor.cs
- ImpersonationContext.cs
- XmlChoiceIdentifierAttribute.cs
- Win32.cs
- WebRequest.cs
- RepeaterItemCollection.cs
- ConfigurationSectionHelper.cs
- ContainerParagraph.cs
- MachineKeyConverter.cs
- PartitionedStream.cs
- SessionIDManager.cs
- IdlingCommunicationPool.cs
- Profiler.cs
- InstanceDataCollectionCollection.cs
- XmlUtil.cs
- ReachFixedPageSerializer.cs
- EmptyEnumerator.cs
- MethodBody.cs
- HighContrastHelper.cs
- ComponentDispatcher.cs
- KeyGestureValueSerializer.cs
- CommonServiceBehaviorElement.cs
- ArcSegment.cs
- UriParserTemplates.cs
- ConfigurationManagerHelper.cs
- FontWeight.cs
- PolicyUnit.cs
- WebPartHelpVerb.cs
- ActivatedMessageQueue.cs
- CategoryAttribute.cs
- RequiredFieldValidator.cs
- ReferenceSchema.cs
- AllowedAudienceUriElement.cs
- UIElement3DAutomationPeer.cs
- TextTreeExtractElementUndoUnit.cs
- ApplicationGesture.cs
- DES.cs
- UpdateManifestForBrowserApplication.cs
- UnsafeNativeMethods.cs
- StdValidatorsAndConverters.cs
- TdsParserSafeHandles.cs
- XamlHostingSection.cs
- IPCCacheManager.cs
- ChildTable.cs
- ContainerSelectorActiveEvent.cs
- HtmlTableCellCollection.cs
- _SafeNetHandles.cs
- GrammarBuilderWildcard.cs
- OperationContractAttribute.cs
- InputLangChangeRequestEvent.cs
- StylusDownEventArgs.cs
- SelfIssuedAuthProofToken.cs
- Pair.cs
- ServiceDebugBehavior.cs
- LookupBindingPropertiesAttribute.cs
- ListDictionary.cs
- TaskExtensions.cs
- PageThemeCodeDomTreeGenerator.cs
- OverrideMode.cs
- GAC.cs
- HttpContext.cs
- AttachmentService.cs
- TakeQueryOptionExpression.cs
- ContentHostHelper.cs
- EventNotify.cs
- HtmlButton.cs
- MenuItemStyleCollection.cs
- FrameworkContentElement.cs
- IncrementalReadDecoders.cs
- SecurityPolicySection.cs
- UpDownEvent.cs
- CollectionViewGroupInternal.cs
- XmlSchemaGroup.cs
- XmlWhitespace.cs
- TextWriterEngine.cs
- AttributeUsageAttribute.cs
- CommandValueSerializer.cs
- PointLightBase.cs
- RoamingStoreFileUtility.cs
- FileResponseElement.cs
- Token.cs
- AnimationClock.cs
- DataGridViewLinkColumn.cs
- InputLanguageCollection.cs
- SubstitutionDesigner.cs
- HttpServerVarsCollection.cs
- CommandConverter.cs
- MenuEventArgs.cs
- BaseHashHelper.cs
- NegationPusher.cs
- LinqDataSourceEditData.cs
- ObjectParameter.cs
- RuntimeCompatibilityAttribute.cs
- FontFaceLayoutInfo.cs
- SafeSecurityHelper.cs
- CompilerErrorCollection.cs
- InstanceDescriptor.cs