ChannelCacheSettings.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Activities / System / ServiceModel / Activities / ChannelCacheSettings.cs / 1305376 / ChannelCacheSettings.cs

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

namespace System.ServiceModel.Activities 
{
    using System.Runtime; 
    using System.ServiceModel; 
    using System.ServiceModel.Channels;
 
    public class ChannelCacheSettings
    {
        TimeSpan idleTimeout;
        TimeSpan leaseTimeout; 
        int maxItemsInCache;
 
        internal static ChannelCacheSettings EmptyCacheSettings = new ChannelCacheSettings { MaxItemsInCache = 0 }; 

        public ChannelCacheSettings() 
        {
            this.idleTimeout = ChannelCacheDefaults.DefaultIdleTimeout;
            this.leaseTimeout = ChannelCacheDefaults.DefaultLeaseTimeout;
            this.maxItemsInCache = ChannelCacheDefaults.DefaultMaxItemsPerCache; 
        }
 
        [Fx.Tag.KnownXamlExternal] 
        public TimeSpan IdleTimeout
        { 
            get
            {
                return this.idleTimeout;
            } 

            set 
            { 
                TimeoutHelper.ThrowIfNegativeArgument(value);
 
                if (TimeoutHelper.IsTooLarge(value))
                {
                    throw FxTrace.Exception.ArgumentOutOfRange("IdleTimeout", value, SR.ValueTooLarge("IdleTimeout"));
                } 

                this.idleTimeout = value; 
            } 
        }
 
        [Fx.Tag.KnownXamlExternal]
        public TimeSpan LeaseTimeout
        {
            get 
            {
                return leaseTimeout; 
            } 
            set
            { 
                TimeoutHelper.ThrowIfNegativeArgument(value);

                if (TimeoutHelper.IsTooLarge(value))
                { 
                    throw FxTrace.Exception.ArgumentOutOfRange("LeaseTimeout", value, SR.ValueTooLarge("LeaseTimeout"));
                } 
 
                this.leaseTimeout = value;
            } 
        }

        public int MaxItemsInCache
        { 
            get
            { 
                return this.maxItemsInCache; 
            }
            set 
            {
                if (value < 0)
                {
                    throw FxTrace.Exception.ArgumentOutOfRange("MaxItemsInCache", value, SR.ValueCannotBeNegative("MaxItemsInCache")); 
                }
 
                this.maxItemsInCache = value; 
            }
        } 
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.


                        

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