File: System\ServiceModel\Configuration\WSDualHttpSecurityElement.cs
Project: ndp\cdf\src\WCF\ServiceModel\System.ServiceModel.csproj (System.ServiceModel)
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------------------------
 
namespace System.ServiceModel.Configuration
{
    using System.Configuration;
    using System.ServiceModel.Channels;
    using System.Globalization;
    using System.Net;
    using System.Net.Security;
    using System.ServiceModel;
    using System.ServiceModel.Security;
    using System.ComponentModel;
 
    public sealed partial class WSDualHttpSecurityElement : ServiceModelConfigurationElement
    {
        [ConfigurationProperty(ConfigurationStrings.Mode, DefaultValue = WSDualHttpSecurity.DefaultMode)]
        [ServiceModelEnumValidator(typeof(WSDualHttpSecurityModeHelper))]
        public WSDualHttpSecurityMode Mode
        {
            get { return (WSDualHttpSecurityMode)base[ConfigurationStrings.Mode]; }
            set { base[ConfigurationStrings.Mode] = value; }
        }
 
        [ConfigurationProperty(ConfigurationStrings.Message)]
        public MessageSecurityOverHttpElement Message
        {
            get { return (MessageSecurityOverHttpElement)base[ConfigurationStrings.Message]; }
        }
 
        internal void ApplyConfiguration(WSDualHttpSecurity security)
        {
            if (security == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("security");
            }
            security.Mode = this.Mode;
            this.Message.ApplyConfiguration(security.Message);
        }
 
        internal void InitializeFrom(WSDualHttpSecurity security)
        {
            if (security == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("security");
            }
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.Mode, security.Mode);
            this.Message.InitializeFrom(security.Message);
        }
    }
}