PeerResolverElement.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / PeerResolverElement.cs / 1 / PeerResolverElement.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.ServiceModel.Configuration 
{
    using System.Configuration; 
    using System.Globalization; 
    using System.Net;
    using System.Net.Security; 
    using System.ServiceModel;
    using System.ComponentModel;
    using System.ServiceModel.PeerResolvers;
 
    public sealed partial class PeerResolverElement : ConfigurationElement
    { 
        [ConfigurationProperty(ConfigurationStrings.Mode, DefaultValue = PeerResolverMode.Auto)] 
        [ServiceModelEnumValidator(typeof(PeerResolverModeHelper))]
        public PeerResolverMode Mode 
        {
            get { return (PeerResolverMode)base[ConfigurationStrings.Mode]; }
            set { base[ConfigurationStrings.Mode] = value; }
        } 

        [ConfigurationProperty(ConfigurationStrings.ReferralPolicy, DefaultValue = PeerReferralPolicy.Service)] 
        [ServiceModelEnumValidator(typeof(PeerReferralPolicyHelper))] 
        public PeerReferralPolicy ReferralPolicy
        { 
            get { return (PeerReferralPolicy)base[ConfigurationStrings.ReferralPolicy]; }
            set { base[ConfigurationStrings.ReferralPolicy] = value; }
        }
 
        [ConfigurationProperty(ConfigurationStrings.Custom)]
        public PeerCustomResolverElement Custom 
        { 
            get { return (PeerCustomResolverElement)base[ConfigurationStrings.Custom]; }
        } 

        internal void ApplyConfiguration(PeerResolverSettings settings)
        {
            if (settings == null) 
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings"); 
            } 
            settings.Mode = this.Mode;
            settings.ReferralPolicy = this.ReferralPolicy; 
            this.Custom.ApplyConfiguration(settings.Custom);
        }

        internal void InitializeFrom(PeerResolverSettings settings) 
        {
            if (settings == null) 
            { 
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings");
            } 
            this.Mode = settings.Mode;
            this.ReferralPolicy = settings.ReferralPolicy;
            this.Custom.InitializeFrom(settings.Custom);
        } 
    }
} 
 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK