MsmqElementBase.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 / MsmqElementBase.cs / 1 / MsmqElementBase.cs

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

namespace System.ServiceModel.Configuration 
{
    using System.Configuration; 
    using System.Net.Security; 
    using System.ServiceModel.Channels;
    using System.ComponentModel; 

    public abstract partial class MsmqElementBase : TransportElement
    {
 
        [ConfigurationProperty(ConfigurationStrings.CustomDeadLetterQueue, DefaultValue = MsmqDefaults.CustomDeadLetterQueue)]
        public Uri CustomDeadLetterQueue 
        { 
            get {return (Uri) base[ConfigurationStrings.CustomDeadLetterQueue]; }
            set {base[ConfigurationStrings.CustomDeadLetterQueue] = value; } 
        }

        [ConfigurationProperty(ConfigurationStrings.DeadLetterQueue, DefaultValue = MsmqDefaults.DeadLetterQueue)]
        [ServiceModelEnumValidator(typeof(DeadLetterQueueHelper))] 
        public DeadLetterQueue DeadLetterQueue
        { 
            get {return (DeadLetterQueue) base[ConfigurationStrings.DeadLetterQueue]; } 
            set {base[ConfigurationStrings.DeadLetterQueue] = value; }
        } 

        [ConfigurationProperty(ConfigurationStrings.Durable, DefaultValue = MsmqDefaults.Durable)]
        public bool Durable
        { 
            get {return (bool) base[ConfigurationStrings.Durable]; }
            set {base[ConfigurationStrings.Durable] = value; } 
        } 

        [ConfigurationProperty(ConfigurationStrings.ExactlyOnce, DefaultValue = MsmqDefaults.ExactlyOnce)] 
        public bool ExactlyOnce
        {
            get {return (bool) base[ConfigurationStrings.ExactlyOnce]; }
            set {base[ConfigurationStrings.ExactlyOnce] = value; } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.MaxRetryCycles, DefaultValue = MsmqDefaults.MaxRetryCycles)] 
        [IntegerValidator(MinValue = 0)]
        public int MaxRetryCycles 
        {
            get {return (int) base[ConfigurationStrings.MaxRetryCycles]; }
            set {base[ConfigurationStrings.MaxRetryCycles] = value; }
        } 

        [ConfigurationProperty(ConfigurationStrings.ReceiveErrorHandling, DefaultValue = MsmqDefaults.ReceiveErrorHandling)] 
        [ServiceModelEnumValidator(typeof(ReceiveErrorHandlingHelper))] 
        public ReceiveErrorHandling ReceiveErrorHandling
        { 
            get {return (ReceiveErrorHandling) base[ConfigurationStrings.ReceiveErrorHandling]; }
            set {base[ConfigurationStrings.ReceiveErrorHandling] = value; }
        }
 
        [ConfigurationProperty(ConfigurationStrings.ReceiveRetryCount, DefaultValue = MsmqDefaults.ReceiveRetryCount)]
        [IntegerValidator(MinValue = 0)] 
        public int ReceiveRetryCount 
        {
            get {return (int) base[ConfigurationStrings.ReceiveRetryCount]; } 
            set {base[ConfigurationStrings.ReceiveRetryCount] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.RetryCycleDelay, DefaultValue = MsmqDefaults.RetryCycleDelayString)] 
        [TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
        [ServiceModelTimeSpanValidator(MinValueString = ConfigurationStrings.TimeSpanZero)] 
        public TimeSpan RetryCycleDelay 
        {
            get {return (TimeSpan) base[ConfigurationStrings.RetryCycleDelay]; } 
            set {base[ConfigurationStrings.RetryCycleDelay] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.MsmqTransportSecurity)] 
        public MsmqTransportSecurityElement MsmqTransportSecurity
        { 
            get { return (MsmqTransportSecurityElement)base[ConfigurationStrings.MsmqTransportSecurity]; } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.TimeToLive, DefaultValue = MsmqDefaults.TimeToLiveString)]
        [TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
        [ServiceModelTimeSpanValidator(MinValueString = ConfigurationStrings.TimeSpanZero)]
        public TimeSpan TimeToLive 
        {
            get {return (TimeSpan) base[ConfigurationStrings.TimeToLive]; } 
            set {base[ConfigurationStrings.TimeToLive] = value; } 
        }
 
        [ConfigurationProperty(ConfigurationStrings.UseSourceJournal, DefaultValue = MsmqDefaults.UseSourceJournal)]
        public bool UseSourceJournal
        {
            get {return (bool) base[ConfigurationStrings.UseSourceJournal]; } 
            set {base[ConfigurationStrings.UseSourceJournal] = value; }
        } 
 
        [ConfigurationProperty(ConfigurationStrings.UseMsmqTracing, DefaultValue = MsmqDefaults.UseMsmqTracing)]
        public bool UseMsmqTracing 
        {
            get {return (bool) base[ConfigurationStrings.UseMsmqTracing]; }
            set {base[ConfigurationStrings.UseMsmqTracing] = value; }
        } 

        public override void ApplyConfiguration(BindingElement bindingElement) 
        { 
            base.ApplyConfiguration(bindingElement);
 
            System.ServiceModel.Channels.MsmqBindingElementBase binding = bindingElement as System.ServiceModel.Channels.MsmqBindingElementBase;
            if (null != binding)
            {
                if (null != this.CustomDeadLetterQueue) 
                    binding.CustomDeadLetterQueue = this.CustomDeadLetterQueue;
                binding.DeadLetterQueue = this.DeadLetterQueue; 
                binding.Durable = this.Durable; 
                binding.ExactlyOnce = this.ExactlyOnce;
                binding.MaxRetryCycles = this.MaxRetryCycles; 
                binding.ReceiveErrorHandling = this.ReceiveErrorHandling;
                binding.ReceiveRetryCount = this.ReceiveRetryCount;
                binding.RetryCycleDelay = this.RetryCycleDelay;
                binding.TimeToLive = this.TimeToLive; 
                binding.UseSourceJournal = this.UseSourceJournal;
                binding.UseMsmqTracing = this.UseMsmqTracing; 
 
                this.MsmqTransportSecurity.ApplyConfiguration(binding.MsmqTransportSecurity);
            } 
        }

        public override void CopyFrom(ServiceModelExtensionElement from)
        { 
            base.CopyFrom(from);
 
            MsmqElementBase source = from as MsmqElementBase; 

            if (null != source) 
            {
                this.CustomDeadLetterQueue = source.CustomDeadLetterQueue;
                this.DeadLetterQueue = source.DeadLetterQueue;
                this.Durable = source.Durable; 
                this.ExactlyOnce = source.ExactlyOnce;
                this.MaxRetryCycles = source.MaxRetryCycles; 
                this.ReceiveErrorHandling = source.ReceiveErrorHandling; 
                this.ReceiveRetryCount = source.ReceiveRetryCount;
                this.RetryCycleDelay = source.RetryCycleDelay; 
                this.TimeToLive = source.TimeToLive;
                this.UseSourceJournal = source.UseSourceJournal;
                this.UseMsmqTracing = source.UseMsmqTracing;
                this.MsmqTransportSecurity.MsmqAuthenticationMode = source.MsmqTransportSecurity.MsmqAuthenticationMode; 
                this.MsmqTransportSecurity.MsmqProtectionLevel = source.MsmqTransportSecurity.MsmqProtectionLevel;
                this.MsmqTransportSecurity.MsmqEncryptionAlgorithm = source.MsmqTransportSecurity.MsmqEncryptionAlgorithm; 
                this.MsmqTransportSecurity.MsmqSecureHashAlgorithm = source.MsmqTransportSecurity.MsmqSecureHashAlgorithm; 
            }
        } 

        protected internal override void InitializeFrom(BindingElement bindingElement)
        {
            base.InitializeFrom(bindingElement); 

            System.ServiceModel.Channels.MsmqBindingElementBase binding = bindingElement as System.ServiceModel.Channels.MsmqBindingElementBase; 
 
            if (null != binding)
            { 
                if (null != binding.CustomDeadLetterQueue)
                    this.CustomDeadLetterQueue = binding.CustomDeadLetterQueue;
                this.DeadLetterQueue = binding.DeadLetterQueue;
                this.Durable = binding.Durable; 
                this.ExactlyOnce = binding.ExactlyOnce;
                this.MaxRetryCycles = binding.MaxRetryCycles; 
                this.ReceiveErrorHandling = binding.ReceiveErrorHandling; 
                this.ReceiveRetryCount = binding.ReceiveRetryCount;
                this.RetryCycleDelay = binding.RetryCycleDelay; 
                this.TimeToLive = binding.TimeToLive;
                this.UseSourceJournal = binding.UseSourceJournal;
                this.UseMsmqTracing = binding.UseMsmqTracing;
                this.MsmqTransportSecurity.InitializeFrom(binding.MsmqTransportSecurity); 
            }
        } 
    } 
}
 



// 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