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
- TransformerInfoCollection.cs
- sqlinternaltransaction.cs
- CodeIdentifiers.cs
- SafeNativeMethods.cs
- ThreadBehavior.cs
- ExtenderControl.cs
- TransformerConfigurationWizardBase.cs
- CustomGrammar.cs
- RegexCompilationInfo.cs
- BamlReader.cs
- DataGridViewRowHeaderCell.cs
- BulletedListEventArgs.cs
- PreProcessInputEventArgs.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- FileDocument.cs
- ZipPackagePart.cs
- LingerOption.cs
- BufferBuilder.cs
- HttpStreamXmlDictionaryWriter.cs
- XamlRtfConverter.cs
- AssemblyNameProxy.cs
- UrlPath.cs
- PageAsyncTaskManager.cs
- Table.cs
- XPathNavigatorReader.cs
- DebugView.cs
- TraversalRequest.cs
- odbcmetadatafactory.cs
- UnsafeNativeMethods.cs
- ScrollableControl.cs
- DescriptionAttribute.cs
- HttpFileCollectionBase.cs
- DBDataPermissionAttribute.cs
- StylusShape.cs
- WebServiceHandlerFactory.cs
- XmlSchemaSimpleContentRestriction.cs
- SQLBytesStorage.cs
- WizardPanel.cs
- ToolboxDataAttribute.cs
- SqlProvider.cs
- SmtpDigestAuthenticationModule.cs
- ContextStaticAttribute.cs
- TypefaceCollection.cs
- NullableLongAverageAggregationOperator.cs
- Transform3D.cs
- ContentFilePart.cs
- XsltQilFactory.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- ObjectDataProvider.cs
- ImageUrlEditor.cs
- JsonClassDataContract.cs
- EllipseGeometry.cs
- CroppedBitmap.cs
- FormatConvertedBitmap.cs
- SQLInt16.cs
- Attributes.cs
- TranslateTransform3D.cs
- LinearGradientBrush.cs
- PropertyValueUIItem.cs
- DependsOnAttribute.cs
- ToolStripContentPanelRenderEventArgs.cs
- ResizeBehavior.cs
- DeferredElementTreeState.cs
- Soap12FormatExtensions.cs
- RequestQueryParser.cs
- AvTraceFormat.cs
- Overlapped.cs
- DataServiceRequest.cs
- EtwTrace.cs
- CalendarDateRangeChangingEventArgs.cs
- XmlImplementation.cs
- PropertyInformation.cs
- Margins.cs
- InternalTypeHelper.cs
- UndirectedGraph.cs
- TextTreeTextNode.cs
- TypeSystem.cs
- AccessorTable.cs
- OdbcConnectionString.cs
- OleDbInfoMessageEvent.cs
- WebPartEditorApplyVerb.cs
- ClientProxyGenerator.cs
- MenuCommandsChangedEventArgs.cs
- PageHandlerFactory.cs
- UInt64Storage.cs
- DataContractAttribute.cs
- ObjectDataSourceDesigner.cs
- Int32Collection.cs
- TaiwanLunisolarCalendar.cs
- HtmlLink.cs
- XmlnsDefinitionAttribute.cs
- ToolStripSplitStackLayout.cs
- SystemSounds.cs
- DataGridDetailsPresenter.cs
- FragmentNavigationEventArgs.cs
- RewritingValidator.cs
- ProbeMatchesApril2005.cs
- odbcmetadatacollectionnames.cs
- WebCategoryAttribute.cs
- SynchronousReceiveElement.cs