⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paramelement.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.Web.Configuration
{
    using System;
    using System.Configuration;
    using System.Globalization;

    public sealed class ParamElement : ConfigurationElement
    {
        private static readonly ConfigurationProperty m_Casesensitive = new ConfigurationProperty("casesensitive", typeof(bool), false);
        private static readonly ConfigurationProperty m_Length = new ConfigurationProperty("length", typeof(int), 0, null, m_LengthValidator, ConfigurationPropertyOptions.None);
        private static readonly IntegerValidator m_LengthValidator = new IntegerValidator(1, 100);
        private static readonly ConfigurationProperty m_Name = new ConfigurationProperty("name", typeof(string), "", ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);
        private static readonly ConfigurationProperty m_Optional = new ConfigurationProperty("optional", typeof(bool), false);
        private static ConfigurationPropertyCollection m_Properties = new ConfigurationPropertyCollection();
        private static readonly ConfigurationProperty m_Type = new ConfigurationProperty("type", typeof(ParamType), null, ConfigurationPropertyOptions.IsRequired);

        public ParamElement()
        {
            m_Properties.Add(m_Name);
            m_Properties.Add(m_Type);
            m_Properties.Add(m_Optional);
            m_Properties.Add(m_Casesensitive);
            m_Properties.Add(m_Length);
        }

        public ParamElement(string elementName)
        {
            this.Name = elementName;
        }

        [ConfigurationProperty("casesensitive", DefaultValue=false)]
        public bool Casesensitive
        {
            get
            {
                return (bool) base[m_Casesensitive];
            }
            set
            {
                base[m_Casesensitive] = value;
            }
        }

        [ConfigurationProperty("length")]
        public int Length
        {
            get
            {
                return (int) base[m_Length];
            }
            set
            {
                base[m_Length] = value;
            }
        }

        [ConfigurationProperty("name", IsKey=true, IsRequired=true)]
        public string Name
        {
            get
            {
                if (!this.Casesensitive)
                {
                    return ((string) base[m_Name]).ToLower(CultureInfo.CurrentCulture);
                }
                return (string) base[m_Name];
            }
            set
            {
                base[m_Name] = value;
            }
        }

        [ConfigurationProperty("optional", DefaultValue=false)]
        public bool Optional
        {
            get
            {
                return (bool) base[m_Optional];
            }
            set
            {
                base[m_Optional] = value;
            }
        }

        protected override ConfigurationPropertyCollection Properties
        {
            get
            {
                return m_Properties;
            }
        }

        [ConfigurationProperty("type", IsRequired=true)]
        public ParamType Type
        {
            get
            {
                return (ParamType) base[m_Type];
            }
            set
            {
                base[m_Type] = value;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -