Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / Configuration / UdpDiscoveryEndpointElement.cs / 1305376 / UdpDiscoveryEndpointElement.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Discovery.Configuration { using System; using System.ComponentModel; using System.Configuration; using System.Diagnostics.CodeAnalysis; using System.Runtime; using System.ServiceModel.Configuration; using System.ServiceModel.Description; public class UdpDiscoveryEndpointElement : DiscoveryEndpointElement { ConfigurationPropertyCollection properties; public UdpDiscoveryEndpointElement() : base() { } [ConfigurationProperty(ConfigurationStrings.MaxResponseDelay, DefaultValue = DiscoveryDefaults.Udp.AppMaxDelayString)] [TypeConverter(typeof(TimeSpanOrInfiniteConverter))] [ServiceModelTimeSpanValidator(MinValueString = ConfigurationStrings.TimeSpanZero)] public new TimeSpan MaxResponseDelay { get { return base.MaxResponseDelay; } set { base.MaxResponseDelay = value; } } [ConfigurationProperty(ConfigurationStrings.DiscoveryMode, DefaultValue = ServiceDiscoveryMode.Adhoc)] [SuppressMessage(FxCop.Category.Configuration, FxCop.Rule.ConfigurationValidatorAttributeRule)] public new ServiceDiscoveryMode DiscoveryMode { get { return base.DiscoveryMode; } set { base.DiscoveryMode = value; } } [ConfigurationProperty(ConfigurationStrings.MulticastAddress, DefaultValue = ProtocolStrings.Udp.MulticastIPv4Address)] [SuppressMessage(FxCop.Category.Configuration, FxCop.Rule.ConfigurationValidatorAttributeRule)] public Uri MulticastAddress { get { return (Uri)base[ConfigurationStrings.MulticastAddress]; } set { if (value == null) { throw FxTrace.Exception.ArgumentNull("value"); } base[ConfigurationStrings.MulticastAddress] = value; } } [ConfigurationProperty(ConfigurationStrings.TransportSettings)] public UdpTransportSettingsElement TransportSettings { get { return (UdpTransportSettingsElement)base[ConfigurationStrings.TransportSettings]; } } protected internal override Type EndpointType { get { return typeof(UdpDiscoveryEndpoint); } } protected override ConfigurationPropertyCollection Properties { get { if (this.properties == null) { ConfigurationPropertyCollection properties = base.Properties; properties.Remove(ConfigurationStrings.DiscoveryMode); properties.Remove(ConfigurationStrings.MaxResponseDelay); properties.Add( new ConfigurationProperty( ConfigurationStrings.MaxResponseDelay, typeof(TimeSpan), DiscoveryDefaults.Udp.AppMaxDelay, new TimeSpanOrInfiniteConverter(), new TimeSpanOrInfiniteValidator(TimeSpan.Zero, TimeSpan.MaxValue), ConfigurationPropertyOptions.None)); properties.Add( new ConfigurationProperty( ConfigurationStrings.DiscoveryMode, typeof(ServiceDiscoveryMode), ServiceDiscoveryMode.Adhoc, null, null, ConfigurationPropertyOptions.None)); properties.Add( new ConfigurationProperty( ConfigurationStrings.MulticastAddress, typeof(Uri), UdpDiscoveryEndpoint.DefaultIPv4MulticastAddress, null, null, ConfigurationPropertyOptions.None)); properties.Add( new ConfigurationProperty( ConfigurationStrings.TransportSettings, typeof(UdpTransportSettingsElement), null, null, null, ConfigurationPropertyOptions.None)); this.properties = properties; } return this.properties; } } protected internal override ServiceEndpoint CreateServiceEndpoint(ContractDescription contractDescription) { return new UdpDiscoveryEndpoint(this.DiscoveryVersion, this.MulticastAddress); } protected internal override void InitializeFrom(ServiceEndpoint endpoint) { base.InitializeFrom(endpoint); UdpDiscoveryEndpoint source = (UdpDiscoveryEndpoint)endpoint; this.MaxResponseDelay = source.MaxResponseDelay; this.DiscoveryMode = source.DiscoveryMode; this.MulticastAddress = source.MulticastAddress; this.TransportSettings.InitializeFrom(source.TransportSettings); } protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement) { base.OnInitializeAndValidate(channelEndpointElement); ConfigurationUtility.InitializeAndValidateUdpChannelEndpointElement(channelEndpointElement); } protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement) { base.OnInitializeAndValidate(serviceEndpointElement); ConfigurationUtility.InitializeAndValidateUdpServiceEndpointElement(serviceEndpointElement); } protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement) { base.OnApplyConfiguration(endpoint, serviceEndpointElement); ApplyConfiguration(endpoint); } protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement) { base.OnApplyConfiguration(endpoint, serviceEndpointElement); ApplyConfiguration(endpoint); } void ApplyConfiguration(ServiceEndpoint endpoint) { UdpDiscoveryEndpoint udpDiscoveryEndpoint = (UdpDiscoveryEndpoint)endpoint; udpDiscoveryEndpoint.MulticastAddress = this.MulticastAddress; this.TransportSettings.ApplyConfiguration(udpDiscoveryEndpoint.TransportSettings); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlC14NWriter.cs
- ParallelLoopState.cs
- Journaling.cs
- Axis.cs
- EdmProperty.cs
- SubMenuStyleCollectionEditor.cs
- SchemaTypeEmitter.cs
- ComboBoxAutomationPeer.cs
- LinearGradientBrush.cs
- NonPrimarySelectionGlyph.cs
- InProcStateClientManager.cs
- DataBoundControlActionList.cs
- Panel.cs
- NodeFunctions.cs
- EventEntry.cs
- Pkcs7Recipient.cs
- FontStretches.cs
- WebPartsSection.cs
- SerialReceived.cs
- odbcmetadatafactory.cs
- UnknownBitmapEncoder.cs
- ListViewCancelEventArgs.cs
- PeerSecurityHelpers.cs
- UnionExpr.cs
- DateTimeParse.cs
- SimpleRecyclingCache.cs
- SqlDataSourceCommandEventArgs.cs
- ComponentChangingEvent.cs
- QueryTreeBuilder.cs
- SqlCacheDependencyDatabaseCollection.cs
- UnmanagedMemoryStreamWrapper.cs
- MultilineStringConverter.cs
- ScrollableControl.cs
- UIElementAutomationPeer.cs
- CodeIdentifiers.cs
- HotCommands.cs
- SelectorItemAutomationPeer.cs
- HandlerFactoryCache.cs
- WebZone.cs
- UIPermission.cs
- SqlDependencyUtils.cs
- TableLayoutRowStyleCollection.cs
- Dynamic.cs
- VerificationAttribute.cs
- UnmanagedMarshal.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- DataColumnChangeEvent.cs
- Transform.cs
- StrongNameIdentityPermission.cs
- userdatakeys.cs
- CustomAttributeBuilder.cs
- XmlAttributeOverrides.cs
- DataSourceDesigner.cs
- XmlNodeChangedEventArgs.cs
- Logging.cs
- Soap11ServerProtocol.cs
- ActivitySurrogate.cs
- ComponentCommands.cs
- CalloutQueueItem.cs
- GetWinFXPath.cs
- SmtpFailedRecipientsException.cs
- DocumentPageHost.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- FlowDocumentReaderAutomationPeer.cs
- AuthenticateEventArgs.cs
- PropertyBuilder.cs
- RequestTimeoutManager.cs
- EnumMember.cs
- ClockGroup.cs
- FreezableDefaultValueFactory.cs
- DesignerCategoryAttribute.cs
- InvokeHandlers.cs
- WebConvert.cs
- TemplatePropertyEntry.cs
- MaterialCollection.cs
- DSACryptoServiceProvider.cs
- TypeInitializationException.cs
- OperationGenerator.cs
- BinaryOperationBinder.cs
- XsltContext.cs
- XmlFormatReaderGenerator.cs
- SecureEnvironment.cs
- Header.cs
- ListViewInsertionMark.cs
- Token.cs
- Column.cs
- DependencyObjectType.cs
- _FtpDataStream.cs
- TcpHostedTransportConfiguration.cs
- SelectorAutomationPeer.cs
- HttpHeaderCollection.cs
- BamlLocalizableResource.cs
- StackOverflowException.cs
- CfgParser.cs
- SqlCrossApplyToCrossJoin.cs
- SlipBehavior.cs
- SubclassTypeValidator.cs
- ResourceExpression.cs
- Wildcard.cs
- TemplateControlParser.cs