當前位置: 首頁>>代碼示例>>C#>>正文


C# Configuration.ConfigurationProperty類代碼示例

本文整理匯總了C#中System.Configuration.ConfigurationProperty的典型用法代碼示例。如果您正苦於以下問題:C# ConfigurationProperty類的具體用法?C# ConfigurationProperty怎麽用?C# ConfigurationProperty使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConfigurationProperty類屬於System.Configuration命名空間,在下文中一共展示了ConfigurationProperty類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AutoConfigurationHelper

        internal AutoConfigurationHelper(ConfigurationElement element, Action<ConfigurationProperty, object> valueSetter, Func<ConfigurationProperty, object> valueGetter)
        {
            _ConfigElement = element;
            _ValueSetter = valueSetter;
            _ValueGetter = valueGetter;

            var type = element.GetType();
            Dictionary<ConfigurationProperty, PropertyInfo> properties;
            if (!_TypeProperties.TryGetValue(type, out properties))
            {
                properties = new Dictionary<ConfigurationProperty, PropertyInfo>();
                foreach (var member in type.GetProperties())
                {
                    var configField = member.GetCustomAttributes(typeof(ConfigurationPropertyAttribute), true).Cast<ConfigurationPropertyAttribute>().FirstOrDefault();
                    if (configField != null)
                    {
                        var property = new ConfigurationProperty(configField.Name, member.PropertyType, configField.DefaultValue, ConfigurationPropertyOptions.None);
                        properties[property] = member;
                    }
                }
                _TypeProperties.TryAdd(type, properties);
            }
            _Properties = properties;

            // Pre-initialize properties of type ConfigurationElement, or things go boom
            foreach (var property in _Properties)
            {
                if (typeof(ConfigurationElement).IsAssignableFrom(property.Value.PropertyType))
                    property.Value.SetValue(_ConfigElement, _ValueGetter(property.Key), null);
            }
        }
開發者ID:marcosb,項目名稱:CommonCore,代碼行數:31,代碼來源:AutoConfigurationSection.cs

示例2: ProfileSettings

		static ProfileSettings ()
		{
			customProp = new ConfigurationProperty ("custom", typeof (string), "");
			maxLimitProp = new ConfigurationProperty ("maxLimit", typeof (int), Int32.MaxValue,
								  PropertyHelper.InfiniteIntConverter,
								  PropertyHelper.IntFromZeroToMaxValidator,
								  ConfigurationPropertyOptions.None);
			minInstancesProp = new ConfigurationProperty ("minInstances", typeof (int), 1,
								      TypeDescriptor.GetConverter (typeof (int)),
								      new IntegerValidator (1, Int32.MaxValue),
								      ConfigurationPropertyOptions.None);
			minIntervalProp = new ConfigurationProperty ("minInterval", typeof (TimeSpan), TimeSpan.FromSeconds (0),
								     PropertyHelper.InfiniteTimeSpanConverter,
								     PropertyHelper.DefaultValidator,
								     ConfigurationPropertyOptions.None);
			nameProp = new ConfigurationProperty ("name", typeof (string), "",
							      TypeDescriptor.GetConverter (typeof (string)),
							      PropertyHelper.NonEmptyStringValidator,
							      ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
			properties = new ConfigurationPropertyCollection ();

			properties.Add (customProp);
			properties.Add (maxLimitProp);
			properties.Add (minInstancesProp);
			properties.Add (minIntervalProp);
			properties.Add (nameProp);

		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:28,代碼來源:ProfileSettings.cs

示例3: LogWriterConfigSection

 static LogWriterConfigSection()
 {
     _logDir = new ConfigurationProperty(
         "logDir",
         typeof(string),
         null,
         ConfigurationPropertyOptions.None
     );
     _logFileName = new ConfigurationProperty(
         "logFileName",
         typeof(string),
         null,
         ConfigurationPropertyOptions.None
     );
     _maxLogAge = new ConfigurationProperty(
         "maxLogAge",
         typeof(int),
         null,
         ConfigurationPropertyOptions.None
     );
     _queueSize = new ConfigurationProperty(
         "queueSize",
         typeof(int),
         null,
         ConfigurationPropertyOptions.None
     );
     _externalLogLib = new ConfigurationProperty(
         "externalLogLib",
         typeof(string),
         null,
         ConfigurationPropertyOptions.None
     );
 }
開發者ID:alexey-zhulin,項目名稱:ETL-processor,代碼行數:33,代碼來源:LogWriterConfigSection.cs

示例4: MembershipSection

        static MembershipSection() {
            // Property initialization
            _propProviders = new ConfigurationProperty("providers", typeof(ProviderSettingsCollection), null, ConfigurationPropertyOptions.None);
            _propDefaultProvider =
                new ConfigurationProperty("defaultProvider",
                                            typeof(string),
                                            "AspNetSqlMembershipProvider",
                                            null,
                                            StdValidatorsAndConverters.NonEmptyStringValidator,
                                            ConfigurationPropertyOptions.None);
            _propUserIsOnlineTimeWindow =
                new ConfigurationProperty("userIsOnlineTimeWindow",
                                            typeof(TimeSpan),
                                            TimeSpan.FromMinutes(15.0),
                                            StdValidatorsAndConverters.TimeSpanMinutesConverter,
                                            new TimeSpanValidator(TimeSpan.FromMinutes(1), TimeSpan.MaxValue),
                                            ConfigurationPropertyOptions.None);
            _propHashAlgorithmType = new ConfigurationProperty("hashAlgorithmType", typeof(string), string.Empty, ConfigurationPropertyOptions.None);

            _properties = new ConfigurationPropertyCollection();
            _properties.Add(_propProviders);
            _properties.Add(_propDefaultProvider);
            _properties.Add(_propUserIsOnlineTimeWindow);
            _properties.Add(_propHashAlgorithmType);
        }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:25,代碼來源:MembershipSection.cs

示例5: MemoryCacheSection

		static MemoryCacheSection ()
		{
			namedCachesProp = new ConfigurationProperty ("namedCaches", typeof (MemoryCacheSettingsCollection), null);

			properties = new ConfigurationPropertyCollection ();
			properties.Add (namedCachesProp);
		}
開發者ID:nzdunic,項目名稱:ravendb,代碼行數:7,代碼來源:MemoryCacheSection.cs

示例6: CodeDomConfigurationHandler

		static CodeDomConfigurationHandler ()
		{
			default_compilers = new CompilerCollection ();
			compilersProp = new ConfigurationProperty ("compilers", typeof (CompilerCollection), default_compilers);
			properties = new ConfigurationPropertyCollection ();
			properties.Add (compilersProp);
		}
開發者ID:ngraziano,項目名稱:mono,代碼行數:7,代碼來源:CodeDomConfigurationHandler.cs

示例7: MessageLoggingElement

		static MessageLoggingElement ()
		{
			properties = new ConfigurationPropertyCollection ();
			filters = new ConfigurationProperty ("filters",
				typeof (XPathMessageFilterElementCollection), null, null/* FIXME: get converter for XPathMessageFilterElementCollection*/, null,
				ConfigurationPropertyOptions.None);

			log_entire_message = new ConfigurationProperty ("logEntireMessage", typeof (bool), false, new BooleanConverter (), null, ConfigurationPropertyOptions.None);

			log_known_pii = new ConfigurationProperty ("logKnownPii", typeof (bool), false, new BooleanConverter (), null, ConfigurationPropertyOptions.None);

			log_malformed_messages = new ConfigurationProperty ("logMalformedMessages", typeof (bool), false, new BooleanConverter (), null, ConfigurationPropertyOptions.None);

			log_messages_at_service_level = new ConfigurationProperty ("logMessagesAtServiceLevel", typeof (bool), false, new BooleanConverter (), null, ConfigurationPropertyOptions.None);

			log_messages_at_transport_level = new ConfigurationProperty ("logMessagesAtTransportLevel", typeof (bool), false, new BooleanConverter (), null, ConfigurationPropertyOptions.None);

			max_messages_to_log = new ConfigurationProperty ("maxMessagesToLog", typeof (int), "10000", null, null, ConfigurationPropertyOptions.None);

			max_size_of_message_to_log = new ConfigurationProperty ("maxSizeOfMessageToLog", typeof (int), 262144, null, null, ConfigurationPropertyOptions.None);

			properties.Add (filters);
			properties.Add (log_entire_message);
			properties.Add (log_known_pii);
			properties.Add (log_malformed_messages);
			properties.Add (log_messages_at_service_level);
			properties.Add (log_messages_at_transport_level);
			properties.Add (max_messages_to_log);
			properties.Add (max_size_of_message_to_log);
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:30,代碼來源:MessageLoggingElement.cs

示例8: WebProxyScriptElement

                static WebProxyScriptElement ()
                {
                        downloadTimeoutProp = new ConfigurationProperty ("downloadTimeout", typeof (TimeSpan), new TimeSpan (0,0,2,0));
                        properties = new ConfigurationPropertyCollection ();

                        properties.Add (downloadTimeoutProp);
                }
開發者ID:nlhepler,項目名稱:mono,代碼行數:7,代碼來源:WebProxyScriptElement.cs

示例9: ExampleSection

        /// <summary>
        /// Predefines the valid properties and prepares
        /// the property collection.
        /// </summary>
        static ExampleSection()
        {
            // Predefine properties here
            s_propString = new ConfigurationProperty(
                "stringValue",
                typeof(string),
                null,
                ConfigurationPropertyOptions.IsRequired
            );

            s_propBool = new ConfigurationProperty(
                "boolValue",
                typeof(bool),
                false,
                ConfigurationPropertyOptions.None
            );

            s_propTimeSpan = new ConfigurationProperty(
                "timeSpanValue",
                typeof(TimeSpan),
                null,
                ConfigurationPropertyOptions.None
            );

            s_properties = new ConfigurationPropertyCollection();

            s_properties.Add(s_propString);
            s_properties.Add(s_propBool);
            s_properties.Add(s_propTimeSpan);
        }
開發者ID:sgh1986915,項目名稱:.net-braintree-spa,代碼行數:34,代碼來源:AuthenticationToggle.cs

示例10: CacheRegionElement

		/// <summary>
		/// Initializes the <see cref="CacheRegionElement"/> class.
		/// </summary>
		static CacheRegionElement()
		{
			//building the properties collection and overriding the properties property apparently
			//increases performace considerably
			properties = new ConfigurationPropertyCollection();

			var nameProperty = new ConfigurationProperty("name", typeof (string), String.Empty,
			                                             ConfigurationPropertyOptions.IsKey);

			properties.Add(nameProperty);

			var relativeExpirationProperty = new ConfigurationProperty("relativeExpiration", typeof (TimeSpan?), null,
			                                                           new TimeSpanSecondsConverter(), null,
			                                                           ConfigurationPropertyOptions.None);

			properties.Add(relativeExpirationProperty);

			var timeOfDayExpirationProperty = new ConfigurationProperty("timeOfDayExpiration", typeof (TimeSpan?), null, null,
			                                                            new NullableTimeSpanValidator(new TimeSpan(0, 0, 0),
			                                                                                          new TimeSpan(23, 59, 59),
			                                                                                          false),
			                                                            ConfigurationPropertyOptions.None);

			properties.Add(timeOfDayExpirationProperty);

			var priorityProperty = new ConfigurationProperty("priority", typeof (CacheItemPriority), CacheItemPriority.Default,
			                                                 ConfigurationPropertyOptions.None);

			properties.Add(priorityProperty);

			var dependenciesProperty = new ConfigurationProperty("dependencies", typeof (CacheDependenciesElement), null,
			                                                     ConfigurationPropertyOptions.None);

			properties.Add(dependenciesProperty);
		}
開發者ID:polyzois,項目名稱:NHibernate.Diegose,代碼行數:38,代碼來源:CacheRegionElement.cs

示例11: WorkflowRuntimeServiceElement

		static WorkflowRuntimeServiceElement ()
			{
				typeProp = new ConfigurationProperty ("type", typeof (string), "");
				properties = new ConfigurationPropertyCollection ();

				properties.Add (typeProp);
			}
開發者ID:alesliehughes,項目名稱:olive,代碼行數:7,代碼來源:WorkflowRuntimeServiceElement.cs

示例12: XmlDictionaryReaderQuotasElement

		static XmlDictionaryReaderQuotasElement ()
		{
			properties = new ConfigurationPropertyCollection ();
			max_array_length = new ConfigurationProperty ("maxArrayLength",
				typeof (int), "0", null/* FIXME: get converter for int*/, null,
				ConfigurationPropertyOptions.None);

			max_bytes_per_read = new ConfigurationProperty ("maxBytesPerRead",
				typeof (int), "0", null/* FIXME: get converter for int*/, null,
				ConfigurationPropertyOptions.None);

			max_depth = new ConfigurationProperty ("maxDepth",
				typeof (int), "0", null/* FIXME: get converter for int*/, null,
				ConfigurationPropertyOptions.None);

			max_name_table_char_count = new ConfigurationProperty ("maxNameTableCharCount",
				typeof (int), "0", null/* FIXME: get converter for int*/, null,
				ConfigurationPropertyOptions.None);

			max_string_content_length = new ConfigurationProperty ("maxStringContentLength",
				typeof (int), "0", null/* FIXME: get converter for int*/, null,
				ConfigurationPropertyOptions.None);

			properties.Add (max_array_length);
			properties.Add (max_bytes_per_read);
			properties.Add (max_depth);
			properties.Add (max_name_table_char_count);
			properties.Add (max_string_content_length);
		}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:29,代碼來源:XmlDictionaryReaderQuotasElement.cs

示例13: CheckPurviewPageElement

        static CheckPurviewPageElement()
        {
            _Pageurl = new ConfigurationProperty("url", typeof(string), string.Empty, ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);
            _Purview = new ConfigurationProperty("purview", typeof(string), string.Empty, ConfigurationPropertyOptions.IsRequired);

            _Properties = new ConfigurationPropertyCollection();
        }
開發者ID:roytown,項目名稱:Bag,代碼行數:7,代碼來源:CheckPurviewPageElement.cs

示例14: CommandCacheDependencyElement

        /// <summary>
        /// Initializes the <see cref="CacheRegionElement"/> class.
        /// </summary>
        static CommandCacheDependencyElement()
        {
            //building the properties collection and overriding the properties property apparently
            //increases performace considerably
            properties = new ConfigurationPropertyCollection();

            var nameProperty = new ConfigurationProperty("name", typeof (string), String.Empty,
                                                         ConfigurationPropertyOptions.IsKey);

            properties.Add(nameProperty);

            var commandProperty = new ConfigurationProperty("command", typeof (string), String.Empty,
                                                            ConfigurationPropertyOptions.IsRequired);

            properties.Add(commandProperty);

            var connectionNameProperty = new ConfigurationProperty("connectionName", typeof (string), String.Empty,
                                                                   ConfigurationPropertyOptions.None);

            properties.Add(connectionNameProperty);

            var isSprocProperty = new ConfigurationProperty("isStoredProcedure", typeof (bool), false,
                                                            ConfigurationPropertyOptions.None);

            properties.Add(isSprocProperty);

            var providerTypeProperty = new ConfigurationProperty("connectionStringProviderType", typeof (System.Type), null,
                                                                 new TypeNameConverter(),
                                                                 new SubclassTypeValidator(typeof (IConnectionStringProvider)),
                                                                 ConfigurationPropertyOptions.None);

            properties.Add(providerTypeProperty);
        }
開發者ID:mpielikis,項目名稱:nhibernate-contrib,代碼行數:36,代碼來源:CommandCacheDependencyElement.cs

示例15: AuthenticationModuleElement

		static AuthenticationModuleElement ()
		{
			typeProp = new ConfigurationProperty ("type", typeof (string), null, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
			properties = new ConfigurationPropertyCollection ();

			properties.Add (typeProp);
		}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:7,代碼來源:AuthenticationModuleElement.cs


注:本文中的System.Configuration.ConfigurationProperty類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。