Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / DiscoveryClientBindingElement.cs / 1305376 / DiscoveryClientBindingElement.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Discovery { using System.Diagnostics.CodeAnalysis; using System.Runtime; using System.ServiceModel; using System.ServiceModel.Channels; using System.ServiceModel.Description; [Fx.Tag.XamlVisible(false)] sealed public class DiscoveryClientBindingElement : BindingElement { [SuppressMessage(FxCop.Category.Security, FxCop.Rule.DoNotDeclareReadOnlyMutableReferenceTypes, Justification = "EndpointAddress is an immutable type.")] public static readonly EndpointAddress DiscoveryEndpointAddress = new EndpointAddress("http://schemas.microsoft.com/discovery/dynamic"); DiscoveryEndpointProvider discoveryEndpointProvider; FindCriteria findCriteria; public DiscoveryClientBindingElement() { this.FindCriteria = new FindCriteria(); this.DiscoveryEndpointProvider = new UdpDiscoveryEndpointProvider(); } public DiscoveryClientBindingElement(DiscoveryEndpointProvider discoveryEndpointProvider, FindCriteria findCriteria) { if (discoveryEndpointProvider == null) { throw FxTrace.Exception.ArgumentNull("discoveryEndpointProvider"); } if (findCriteria == null) { throw FxTrace.Exception.ArgumentNull("findCriteria"); } this.findCriteria = findCriteria; this.discoveryEndpointProvider = discoveryEndpointProvider; } private DiscoveryClientBindingElement(DiscoveryClientBindingElement elementToBeCloned) : base(elementToBeCloned) { this.discoveryEndpointProvider = elementToBeCloned.DiscoveryEndpointProvider; this.findCriteria = elementToBeCloned.FindCriteria.Clone();; } public DiscoveryEndpointProvider DiscoveryEndpointProvider { get { return this.discoveryEndpointProvider; } set { if (value == null) { throw FxTrace.Exception.ArgumentNull("value"); } this.discoveryEndpointProvider = value; } } public FindCriteria FindCriteria { get { return this.findCriteria; } set { if (value == null) { throw FxTrace.Exception.ArgumentNull("value"); } this.findCriteria = value; } } public override bool CanBuildChannelFactory(BindingContext context) { if (context == null) { throw FxTrace.Exception.ArgumentNull("context"); } if (typeof(TChannel) == typeof(IOutputChannel) || typeof(TChannel) == typeof(IDuplexChannel) || typeof(TChannel) == typeof(IRequestChannel) || typeof(TChannel) == typeof(IOutputSessionChannel) || typeof(TChannel) == typeof(IRequestSessionChannel) || typeof(TChannel) == typeof(IDuplexSessionChannel)) { return context.CanBuildInnerChannelFactory (); } return false; } public override IChannelFactory BuildChannelFactory (BindingContext context) { if (context == null) { throw FxTrace.Exception.ArgumentNull("context"); } if (context.Binding.Elements.IndexOf(this) != 0) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.DiscoveryClientBindingElementNotFirst)); } if (this.CanBuildChannelFactory (context)) { return new DiscoveryClientChannelFactory ( context.BuildInnerChannelFactory (), this.FindCriteria, this.DiscoveryEndpointProvider); } else { throw FxTrace.Exception.Argument("TChannel", ServiceModel.SR.GetString(ServiceModel.SR.ChannelTypeNotSupported, typeof(TChannel))); } } public override bool CanBuildChannelListener (BindingContext context) { if (context == null) { throw FxTrace.Exception.ArgumentNull("context"); } return false; } public override IChannelListener BuildChannelListener (BindingContext context) { if (context == null) { throw FxTrace.Exception.ArgumentNull("context"); } throw FxTrace.Exception.Argument("TChannel", ServiceModel.SR.GetString(ServiceModel.SR.ChannelTypeNotSupported, typeof(TChannel))); } public override BindingElement Clone() { return new DiscoveryClientBindingElement(this); } public override T GetProperty (BindingContext context) { if (context == null) { throw FxTrace.Exception.ArgumentNull("context"); } return context.GetInnerProperty (); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GetPageNumberCompletedEventArgs.cs
- __Filters.cs
- DataGridViewButtonCell.cs
- ViewStateModeByIdAttribute.cs
- Rules.cs
- ButtonChrome.cs
- CryptoApi.cs
- MaskInputRejectedEventArgs.cs
- CodeTypeDeclarationCollection.cs
- cryptoapiTransform.cs
- XmlWrappingWriter.cs
- XmlAggregates.cs
- BrushProxy.cs
- CompositionTarget.cs
- HttpProfileBase.cs
- AsyncCompletedEventArgs.cs
- ConfigurationSectionHelper.cs
- ScrollContentPresenter.cs
- MetadataArtifactLoaderCompositeFile.cs
- UnsafeNativeMethods.cs
- XPathAncestorQuery.cs
- SizeConverter.cs
- SecurityUtils.cs
- DbParameterHelper.cs
- LingerOption.cs
- HttpWebResponse.cs
- RichTextBox.cs
- BaseTemplateCodeDomTreeGenerator.cs
- XPathDescendantIterator.cs
- WaitHandle.cs
- WebZoneDesigner.cs
- PassportPrincipal.cs
- FixUp.cs
- XmlBinaryReader.cs
- UrlPath.cs
- ExpandCollapseIsCheckedConverter.cs
- BitSet.cs
- Size3DConverter.cs
- BatchStream.cs
- SqlDataSourceCustomCommandEditor.cs
- DoubleKeyFrameCollection.cs
- MergePropertyDescriptor.cs
- X509CertificateEndpointIdentity.cs
- SqlPersonalizationProvider.cs
- DataRowView.cs
- OdbcInfoMessageEvent.cs
- EntityAdapter.cs
- ConnectAlgorithms.cs
- XmlAtomErrorReader.cs
- RadioButtonRenderer.cs
- FileDialogPermission.cs
- HtmlElementEventArgs.cs
- EntityDataSourceState.cs
- QilLiteral.cs
- LinqDataSourceDisposeEventArgs.cs
- TableItemStyle.cs
- ErrorLog.cs
- CanExpandCollapseAllConverter.cs
- IssuedSecurityTokenParameters.cs
- SQLSingle.cs
- ColumnWidthChangingEvent.cs
- ImageUrlEditor.cs
- CodeDirectiveCollection.cs
- SafeFileMappingHandle.cs
- CharEntityEncoderFallback.cs
- PermissionSet.cs
- DecoderFallbackWithFailureFlag.cs
- SystemColors.cs
- AppSettingsSection.cs
- datacache.cs
- CodeMethodReturnStatement.cs
- XmlSchemaDocumentation.cs
- WebAdminConfigurationHelper.cs
- ToolStripSeparatorRenderEventArgs.cs
- ContractMapping.cs
- LogReserveAndAppendState.cs
- XmlSchemaSimpleTypeList.cs
- EUCJPEncoding.cs
- OAVariantLib.cs
- EntityTransaction.cs
- ListBox.cs
- HttpCachePolicyElement.cs
- FieldDescriptor.cs
- _OverlappedAsyncResult.cs
- WebCategoryAttribute.cs
- DataTemplateSelector.cs
- configsystem.cs
- ApplicationServicesHostFactory.cs
- InternalRelationshipCollection.cs
- SchemaTypeEmitter.cs
- DoWorkEventArgs.cs
- basenumberconverter.cs
- Button.cs
- AsymmetricSignatureDeformatter.cs
- TextModifierScope.cs
- BindingCollection.cs
- QilReference.cs
- Property.cs
- Visual3D.cs
- NativeMethods.cs