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
- BufferedWebEventProvider.cs
- XhtmlBasicFormAdapter.cs
- _ListenerRequestStream.cs
- ResourceProperty.cs
- WeakReferenceList.cs
- MetafileHeader.cs
- RuleInfoComparer.cs
- ReadOnlyTernaryTree.cs
- BlurBitmapEffect.cs
- DataObjectFieldAttribute.cs
- SerializationAttributes.cs
- VerificationException.cs
- Function.cs
- IndentTextWriter.cs
- _SslStream.cs
- FixedSOMTableRow.cs
- PictureBox.cs
- MatrixTransform3D.cs
- XpsViewerException.cs
- DrawingCollection.cs
- RegexGroup.cs
- ScriptComponentDescriptor.cs
- CardSpacePolicyElement.cs
- Clause.cs
- MessageEncoder.cs
- HtmlElementEventArgs.cs
- ActivationArguments.cs
- AuthorizationSection.cs
- PageCodeDomTreeGenerator.cs
- DataTableCollection.cs
- RegionIterator.cs
- SecurityTokenRequirement.cs
- XmlQueryType.cs
- DefaultWorkflowSchedulerService.cs
- SignedInfo.cs
- UnsafeNativeMethods.cs
- AmbiguousMatchException.cs
- CodeTypeReferenceCollection.cs
- ProgressBarHighlightConverter.cs
- LinkLabelLinkClickedEvent.cs
- ValueType.cs
- HttpSessionStateWrapper.cs
- CallTemplateAction.cs
- BitmapEffect.cs
- EventItfInfo.cs
- SafeSecurityHelper.cs
- BitStack.cs
- DateTimeSerializationSection.cs
- WasEndpointConfigContainer.cs
- EmulateRecognizeCompletedEventArgs.cs
- TreeNodeStyle.cs
- ProjectionCamera.cs
- ProcessHostMapPath.cs
- ViewPort3D.cs
- SynchronizedInputPattern.cs
- FrugalMap.cs
- RequestQueryProcessor.cs
- SafeBitVector32.cs
- OperatorExpressions.cs
- BufferedGraphicsContext.cs
- DeliveryStrategy.cs
- WindowsAltTab.cs
- OleDbFactory.cs
- PropertyDescriptor.cs
- HtmlLink.cs
- PropertyToken.cs
- FragmentNavigationEventArgs.cs
- ThreadPool.cs
- HostingEnvironment.cs
- PrintPreviewDialog.cs
- CopyAction.cs
- CachedPathData.cs
- QilNode.cs
- AncestorChangedEventArgs.cs
- FontFamilyConverter.cs
- BinaryConverter.cs
- DataServiceEntityAttribute.cs
- MarkupProperty.cs
- ObjectConverter.cs
- WebUtil.cs
- MailDefinition.cs
- SoundPlayer.cs
- MethodToken.cs
- AsyncPostBackTrigger.cs
- DataGridViewCellConverter.cs
- BoundField.cs
- TransportChannelListener.cs
- TagMapCollection.cs
- PolicyStatement.cs
- SingletonConnectionReader.cs
- LocationEnvironment.cs
- Types.cs
- DataGridTable.cs
- ConnectionProviderAttribute.cs
- XmlBoundElement.cs
- DataGridViewColumnCollectionEditor.cs
- HttpClientCertificate.cs
- SafeLocalAllocation.cs
- BindingValueChangedEventArgs.cs
- RelationshipEndMember.cs