1 //------------------------------------------------------------------------------ 2 // Copyright (c) Microsoft Corporation. All rights reserved. 3 //------------------------------------------------------------------------------ 4 5 namespace System.ServiceModel.Configuration 6 { 7 using System.Configuration; 8 using System.ServiceModel.Channels; 9 using System.Globalization; 10 using System.Net; 11 using System.Net.Security; 12 using System.ServiceModel; 13 using System.ServiceModel.Security; 14 using System.ComponentModel; 15 16 public sealed partial class NetMsmqSecurityElement : ServiceModelConfigurationElement 17 { 18 [ConfigurationProperty(ConfigurationStrings.Mode, DefaultValue = NetMsmqSecurity.DefaultMode)] 19 [ServiceModelEnumValidator(typeof(SecurityModeHelper))] 20 public NetMsmqSecurityMode Mode 21 { 22 get { return (NetMsmqSecurityMode)base[ConfigurationStrings.Mode]; } 23 set { base[ConfigurationStrings.Mode] = value; } 24 } 25 26 [ConfigurationProperty(ConfigurationStrings.Transport)] 27 public MsmqTransportSecurityElement Transport 28 { 29 get { return (MsmqTransportSecurityElement)base[ConfigurationStrings.Transport]; } 30 } 31 32 [ConfigurationProperty(ConfigurationStrings.Message)] 33 public MessageSecurityOverMsmqElement Message 34 { 35 get { return (MessageSecurityOverMsmqElement)base[ConfigurationStrings.Message]; } 36 } 37 ApplyConfiguration(NetMsmqSecurity security)38 internal void ApplyConfiguration(NetMsmqSecurity security) 39 { 40 if (security == null) 41 { 42 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("security"); 43 } 44 security.Mode = this.Mode; 45 this.Transport.ApplyConfiguration(security.Transport); 46 this.Message.ApplyConfiguration(security.Message); 47 } 48 InitializeFrom(NetMsmqSecurity security)49 internal void InitializeFrom(NetMsmqSecurity security) 50 { 51 if (security == null) 52 { 53 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("security"); 54 } 55 SetPropertyValueIfNotDefaultValue(ConfigurationStrings.Mode, security.Mode); 56 this.Transport.InitializeFrom(security.Transport); 57 this.Message.InitializeFrom(security.Message); 58 } 59 } 60 } 61