static ParameterRulesElement()
        {
            _ignoreRules = new ConfigurationProperty(
                "ignore",
                typeof(IgnoreRuleElementCollection),
                null,
                ConfigurationPropertyOptions.None
            );

            _requireRules = new ConfigurationProperty(
                "require",
                typeof(RequireRuleElementCollection),
                null,
                ConfigurationPropertyOptions.None
            );

            _mappingRules = new ConfigurationProperty(
                "mapping",
                typeof(MappingRuleElementCollection),
                null,
                ConfigurationPropertyOptions.None
            );

            _properties = new ConfigurationPropertyCollection()
            {
                _ignoreRules,
                _requireRules,
                _mappingRules,
            };
        }
Exemple #2
0
		static MemoryCacheElement ()
		{
			cacheMemoryLimitMegabytesProp = new ConfigurationProperty ("cacheMemoryLimitMegabytes", typeof (int), 0,
										   TypeDescriptor.GetConverter (typeof (int)),
										   new IntegerValidator (1, Int32.MaxValue),
										   ConfigurationPropertyOptions.None);
			nameProp = new ConfigurationProperty ("name", typeof (string), String.Empty,
							      TypeDescriptor.GetConverter (typeof (string)),
							      new NullableStringValidator (1),
							      ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);
			physicalMemoryLimitPercentageProp = new ConfigurationProperty ("physicalMemoryLimitPercentage", typeof (int), 0,
										       TypeDescriptor.GetConverter (typeof (int)),
										       new IntegerValidator (1, 100),
										       ConfigurationPropertyOptions.None);
			pollingIntervalProp = new ConfigurationProperty ("pollingInterval", typeof (TimeSpan), TimeSpan.FromMinutes (2),
									 new InfiniteTimeSpanConverter (),
									 new DefaultValidator (),
									 ConfigurationPropertyOptions.None);

			properties = new ConfigurationPropertyCollection ();
			properties.Add (cacheMemoryLimitMegabytesProp);
			properties.Add (nameProp);
			properties.Add (physicalMemoryLimitPercentageProp);
			properties.Add (pollingIntervalProp);
		}
		static CertificateReferenceElement ()
		{
			properties = new ConfigurationPropertyCollection ();
			find_value = new ConfigurationProperty ("findValue",
				typeof (string), "", new StringConverter (), null,
				ConfigurationPropertyOptions.None);

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

			store_location = new ConfigurationProperty ("storeLocation",
				typeof (StoreLocation), "LocalMachine", null/* FIXME: get converter for StoreLocation*/, null,
				ConfigurationPropertyOptions.None);

			store_name = new ConfigurationProperty ("storeName",
				typeof (StoreName), "My", null/* FIXME: get converter for StoreName*/, null,
				ConfigurationPropertyOptions.None);

			x509_find_type = new ConfigurationProperty ("x509FindType",
				typeof (X509FindType), "FindBySubjectDistinguishedName", null/* FIXME: get converter for X509FindType*/, null,
				ConfigurationPropertyOptions.None);

			properties.Add (find_value);
			properties.Add (is_chain_included);
			properties.Add (store_location);
			properties.Add (store_name);
			properties.Add (x509_find_type);
		}
		static MemoryCacheSection ()
		{
			namedCachesProp = new ConfigurationProperty ("namedCaches", typeof (MemoryCacheSettingsCollection), null);

			properties = new ConfigurationPropertyCollection ();
			properties.Add (namedCachesProp);
		}
Exemple #5
0
		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);

		}
Exemple #6
0
		static DiagnosticSection ()
		{
			properties = new ConfigurationPropertyCollection ();
#if NET_4_0
			end_to_end_tracing = new ConfigurationProperty ("endToEndTracing", typeof (EndToEndTracingElement), null, null, null, ConfigurationPropertyOptions.None);

			etw_provider_id = new ConfigurationProperty ("etwProviderId", typeof (string), null, null, null, ConfigurationPropertyOptions.None);
#endif
			message_logging = new ConfigurationProperty ("messageLogging", typeof (MessageLoggingElement), null, null, null, ConfigurationPropertyOptions.None);

			performance_counters = new ConfigurationProperty ("performanceCounters", typeof (PerformanceCounterScope), "Off", null, null, ConfigurationPropertyOptions.None);

			performance_counter_enabled = new ConfigurationProperty ("performanceCounterEnabled", typeof (bool), false, null, null, ConfigurationPropertyOptions.None);

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

#if NET_4_0
			properties.Add (end_to_end_tracing);
			properties.Add (etw_provider_id);
#endif
			properties.Add (message_logging);
			properties.Add (performance_counters);
			properties.Add (performance_counter_enabled);
			properties.Add (wmi_provider_enabled);
		}
Exemple #7
0
		static DiagnosticsElement ()
		{
			suppressReturningExceptionsProp = new ConfigurationProperty ("suppressReturningExceptions", typeof (bool), false);
			properties = new ConfigurationPropertyCollection ();

			properties.Add (suppressReturningExceptionsProp);
		}
        static ResourcePurviewElement()
        {
            _Name = new ConfigurationProperty("name", typeof(string), string.Empty, ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);
            _Value = new ConfigurationProperty("value", typeof(string), string.Empty, ConfigurationPropertyOptions.IsRequired);

            _Properties = new ConfigurationPropertyCollection();
        }
		static ProfilePropertySettings ()
		{
			allowAnonymousProp = new ConfigurationProperty ("allowAnonymous", typeof (bool), false);
			customProviderDataProp = new ConfigurationProperty ("customProviderData", typeof (string), "");
			defaultValueProp = new ConfigurationProperty ("defaultValue", typeof (string), "");
			nameProp = new ConfigurationProperty ("name", typeof (string), null,
							      TypeDescriptor.GetConverter (typeof (string)),
							      new ProfilePropertyNameValidator (),
							      ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
			providerProp = new ConfigurationProperty ("provider", typeof (string), "");
			readOnlyProp = new ConfigurationProperty ("readOnly", typeof (bool), false);
			serializeAsProp = new ConfigurationProperty ("serializeAs", typeof (SerializationMode), SerializationMode.ProviderSpecific,
								     new GenericEnumConverter (typeof (SerializationMode)),
								     PropertyHelper.DefaultValidator,
								     ConfigurationPropertyOptions.None);
			typeProp = new ConfigurationProperty ("type", typeof (string), "string");

			properties = new ConfigurationPropertyCollection ();
			properties.Add (allowAnonymousProp);
			properties.Add (customProviderDataProp);
			properties.Add (defaultValueProp);
			properties.Add (nameProp);
			properties.Add (providerProp);
			properties.Add (readOnlyProp);
			properties.Add (serializeAsProp);
			properties.Add (typeProp);
		}
Exemple #10
0
		static CacheSection ()
		{
			disableExpirationProp = new ConfigurationProperty("disableExpiration", typeof (bool), false);
			disableMemoryCollectionProp = new ConfigurationProperty("disableMemoryCollection", typeof (bool), false);
			percentagePhysicalMemoryUsedLimitProp = new ConfigurationProperty("percentagePhysicalMemoryUsedLimit",
											  typeof (int), 0,
											  TypeDescriptor.GetConverter (typeof (int)),
											  PropertyHelper.IntFromZeroToMaxValidator,
											  ConfigurationPropertyOptions.None);
			privateBytesLimitProp = new ConfigurationProperty("privateBytesLimit", typeof (long), 0L,
									  TypeDescriptor.GetConverter (typeof (long)),
									  new LongValidator (0, Int64.MaxValue),
									  ConfigurationPropertyOptions.None);
			privateBytesPollTimeProp = new ConfigurationProperty("privateBytesPollTime",
									     typeof (TimeSpan),
									     TimeSpan.FromMinutes (2),
									     PropertyHelper.InfiniteTimeSpanConverter,
									     PropertyHelper.PositiveTimeSpanValidator,
									     ConfigurationPropertyOptions.None);
			properties = new ConfigurationPropertyCollection();

			properties.Add (disableExpirationProp);
			properties.Add (disableMemoryCollectionProp);
			properties.Add (percentagePhysicalMemoryUsedLimitProp);
			properties.Add (privateBytesLimitProp);
			properties.Add (privateBytesPollTimeProp);
		}
        /// <summary>
        /// Gets the <see cref="CategorizedSettingsElementCollection"/> object representing settings under the specified category name.
        /// </summary>
        /// <param name="name">Name of the category whose settings are to be retrieved.</param>
        /// <returns><see cref="CategorizedSettingsElementCollection"/> object with settings under the specified category name.</returns>
        public new CategorizedSettingsElementCollection this[string name]
        {
            get
            {
                // We will add the requested category to the default properties collection, so that when
                // the settings are saved off to the config file, all of the categories under which
                // settings may be saved are processed and saved to the config file. This is essentially
                // doing what marking a property with the <ConfigurationProperty()> attribute does.
                // Make the first letter of category name lower case, if not already.
                char[] nameChars = name.ToCharArray();
                nameChars[0] = char.ToLower(nameChars[0]);
                // Do not allow spaces in the category name, so that underlying .Net configuration API does not
                // break.
                name = (new string(nameChars)).RemoveWhiteSpace();
                ConfigurationProperty configProperty = new ConfigurationProperty(name, typeof(CategorizedSettingsElementCollection));

                base.Properties.Add(configProperty);
                CategorizedSettingsElementCollection settingsCategory = null;
                if (base[configProperty] != null)
                {
                    settingsCategory = (CategorizedSettingsElementCollection)base[configProperty];
                }
                settingsCategory.SetCryptoKey(m_cryptoKey);

                return settingsCategory;
            }
        }
		public WindowsFormsSection ()
		{
			properties = new ConfigurationPropertyCollection();
			jit_debugging = new ConfigurationProperty ("jitDebugging", typeof (bool), false);

			properties.Add (jit_debugging);
		}
		static X509ClientCertificateAuthenticationElement ()
		{
			properties = new ConfigurationPropertyCollection ();
			certificate_validation_mode = new ConfigurationProperty ("certificateValidationMode",
				typeof (X509CertificateValidationMode), "ChainTrust", null/* FIXME: get converter for X509CertificateValidationMode*/, null,
				ConfigurationPropertyOptions.None);

			custom_certificate_validator_type = new ConfigurationProperty ("customCertificateValidatorType",
				typeof (string), "", new StringConverter (), null,
				ConfigurationPropertyOptions.None);

			include_windows_groups = new ConfigurationProperty ("includeWindowsGroups",
				typeof (bool), "true", new BooleanConverter (), null,
				ConfigurationPropertyOptions.None);

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

			revocation_mode = new ConfigurationProperty ("revocationMode",
				typeof (X509RevocationMode), "Online", null/* FIXME: get converter for X509RevocationMode*/, null,
				ConfigurationPropertyOptions.None);

			trusted_store_location = new ConfigurationProperty ("trustedStoreLocation",
				typeof (StoreLocation), "LocalMachine", null/* FIXME: get converter for StoreLocation*/, null,
				ConfigurationPropertyOptions.None);

			properties.Add (certificate_validation_mode);
			properties.Add (custom_certificate_validator_type);
			properties.Add (include_windows_groups);
			properties.Add (map_client_certificate_to_windows_account);
			properties.Add (revocation_mode);
			properties.Add (trusted_store_location);
		}
		static WorkflowRuntimeServiceElement ()
			{
				typeProp = new ConfigurationProperty ("type", typeof (string), "");
				properties = new ConfigurationPropertyCollection ();

				properties.Add (typeProp);
			}
        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);
        }
		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);
		}
		/// <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);
		}
        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();
        }
        /// <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);
        }
        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);
            }
        }
Exemple #21
0
        private static ConfigurationPropertyCollection EnsureStaticPropertyBag()
        {
            if (s_properties != null) return s_properties;

            ConfigurationProperty propAppSettings = new ConfigurationProperty(
                name: null,
                type: typeof(KeyValueConfigurationCollection),
                defaultValue: null,
                options: ConfigurationPropertyOptions.IsDefaultCollection);

            ConfigurationProperty propFile = new ConfigurationProperty(
                name: "file",
                type: typeof(string),
                defaultValue: string.Empty,
                options: ConfigurationPropertyOptions.None);

            ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection
            {
                propAppSettings,
                propFile
            };

            s_propAppSettings = propAppSettings;
            s_propFile = propFile;
            s_properties = properties;

            return s_properties;
        }
Exemple #22
0
		static SessionStateSection ()
		{
			allowCustomSqlDatabaseProp = new ConfigurationProperty ("allowCustomSqlDatabase", typeof (bool), false);
			cookielessProp = new ConfigurationProperty ("cookieless", typeof (string), null);
			cookieNameProp = new ConfigurationProperty ("cookieName", typeof (string), "ASP.NET_SessionId");
			customProviderProp = new ConfigurationProperty ("customProvider", typeof (string), "");
			modeProp = new ConfigurationProperty ("mode", typeof (SessionStateMode), SessionStateMode.InProc,
							      new GenericEnumConverter (typeof (SessionStateMode)), null,
							      ConfigurationPropertyOptions.None);
			partitionResolverTypeProp = new ConfigurationProperty ("partitionResolverType", typeof (string), "");
			providersProp = new ConfigurationProperty ("providers", typeof (ProviderSettingsCollection), null,
								   null, null, ConfigurationPropertyOptions.None);
			regenerateExpiredSessionIdProp = new ConfigurationProperty ("regenerateExpiredSessionId", typeof (bool), true);
			sessionIDManagerTypeProp = new ConfigurationProperty ("sessionIDManagerType", typeof (string), "");
			sqlCommandTimeoutProp = new ConfigurationProperty ("sqlCommandTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (30),
									   PropertyHelper.TimeSpanSecondsOrInfiniteConverter, null,
									   ConfigurationPropertyOptions.None);
			sqlConnectionStringProp = new ConfigurationProperty ("sqlConnectionString", typeof (string), DefaultSqlConnectionString);
			stateConnectionStringProp = new ConfigurationProperty ("stateConnectionString", typeof (string), "tcpip=loopback:42424");
			stateNetworkTimeoutProp = new ConfigurationProperty ("stateNetworkTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (10),
									     PropertyHelper.TimeSpanSecondsOrInfiniteConverter,
									     PropertyHelper.PositiveTimeSpanValidator,
									     ConfigurationPropertyOptions.None);
			timeoutProp = new ConfigurationProperty ("timeout", typeof (TimeSpan), TimeSpan.FromMinutes (20),
								 PropertyHelper.TimeSpanMinutesOrInfiniteConverter,
								 new TimeSpanValidator (new TimeSpan (0,1,0), TimeSpan.MaxValue),
								 ConfigurationPropertyOptions.None);
			useHostingIdentityProp = new ConfigurationProperty ("useHostingIdentity", typeof (bool), true);

#if NET_4_0
			compressionEnabledProp = new ConfigurationProperty ("compressionEnabled", typeof (bool), false);
			sqlConnectionRetryIntervalProp = new ConfigurationProperty ("sqlConnectionRetryIntervalProp", typeof (TimeSpan), TimeSpan.FromSeconds (0),
										    PropertyHelper.TimeSpanSecondsOrInfiniteConverter,
										    PropertyHelper.PositiveTimeSpanValidator,
										    ConfigurationPropertyOptions.None);
#endif
			properties = new ConfigurationPropertyCollection ();

			properties.Add (allowCustomSqlDatabaseProp);
			properties.Add (cookielessProp);
			properties.Add (cookieNameProp);
			properties.Add (customProviderProp);
			properties.Add (modeProp);
			properties.Add (partitionResolverTypeProp);
			properties.Add (providersProp);
			properties.Add (regenerateExpiredSessionIdProp);
			properties.Add (sessionIDManagerTypeProp);
			properties.Add (sqlCommandTimeoutProp);
			properties.Add (sqlConnectionStringProp);
			properties.Add (stateConnectionStringProp);
			properties.Add (stateNetworkTimeoutProp);
			properties.Add (timeoutProp);
			properties.Add (useHostingIdentityProp);
#if NET_4_0
			properties.Add (compressionEnabledProp);
			properties.Add (sqlConnectionRetryIntervalProp);
#endif

			elementProperty = new ConfigurationElementProperty (new CallbackValidator (typeof (SessionStateSection), ValidateElement));
		}
		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);
		}
                static WebProxyScriptElement ()
                {
                        downloadTimeoutProp = new ConfigurationProperty ("downloadTimeout", typeof (TimeSpan), new TimeSpan (0,0,2,0));
                        properties = new ConfigurationPropertyCollection ();

                        properties.Add (downloadTimeoutProp);
                }
		static WebMessageEncodingElement ()
		{
			properties = new ConfigurationPropertyCollection ();
			binding_element_type = new ConfigurationProperty ("",
				typeof (Type), null, new TypeConverter (), null,
				ConfigurationPropertyOptions.None);

			max_read_pool_size = new ConfigurationProperty ("maxReadPoolSize",
				typeof (int), "64", null/* FIXME: get converter for int*/, null,
				ConfigurationPropertyOptions.None);

			max_write_pool_size = new ConfigurationProperty ("maxWritePoolSize",
				typeof (int), "16", null/* FIXME: get converter for int*/, null,
				ConfigurationPropertyOptions.None);

			reader_quotas = new ConfigurationProperty ("readerQuotas",
				typeof (XmlDictionaryReaderQuotasElement), null, null/* FIXME: get converter for XmlDictionaryReaderQuotasElement*/, null,
				ConfigurationPropertyOptions.None);

			write_encoding = new ConfigurationProperty ("writeEncoding",
				typeof (Encoding), "utf-8", null/* FIXME: get converter for Encoding*/, null,
				ConfigurationPropertyOptions.None);

			web_content_type_mapper_type = new ConfigurationProperty ("",
				typeof (string), null, null /* FIXME: supply */, null,
				ConfigurationPropertyOptions.None);

			properties.Add (binding_element_type);
			properties.Add (max_read_pool_size);
			properties.Add (max_write_pool_size);
			properties.Add (reader_quotas);
			properties.Add (write_encoding);
			properties.Add (web_content_type_mapper_type);
		}
        /// <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);
        }
		static AuthenticationModuleElement ()
		{
			typeProp = new ConfigurationProperty ("type", typeof (string), null, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
			properties = new ConfigurationPropertyCollection ();

			properties.Add (typeProp);
		}
Exemple #28
0
		static RoleManagerSection ()
		{
			cacheRolesInCookieProp = new ConfigurationProperty ("cacheRolesInCookie", typeof (bool), false);
			cookieNameProp = new ConfigurationProperty ("cookieName", typeof (string), ".ASPXROLES");
			cookiePathProp = new ConfigurationProperty ("cookiePath", typeof (string), "/");
			cookieProtectionProp = new ConfigurationProperty ("cookieProtection", typeof (CookieProtection),
									  CookieProtection.All);
			cookieRequireSSLProp = new ConfigurationProperty ("cookieRequireSSL", typeof (bool), false);
			cookieSlidingExpirationProp = new ConfigurationProperty ("cookieSlidingExpiration", typeof (bool), true);
			cookieTimeoutProp = new ConfigurationProperty ("cookieTimeout", typeof (TimeSpan), TimeSpan.FromMinutes (30),
								       PropertyHelper.TimeSpanMinutesOrInfiniteConverter,
								       PropertyHelper.PositiveTimeSpanValidator,
								       ConfigurationPropertyOptions.None);
			createPersistentCookieProp = new ConfigurationProperty ("createPersistentCookie", typeof (bool), false);
			defaultProviderProp = new ConfigurationProperty ("defaultProvider", typeof (string), "AspNetSqlRoleProvider");
			domainProp = new ConfigurationProperty ("domain", typeof (string), "");
			enabledProp = new ConfigurationProperty ("enabled", typeof (bool), false);
			maxCachedResultsProp = new ConfigurationProperty ("maxCachedResults", typeof (int), 25);
			providersProp = new ConfigurationProperty ("providers", typeof (ProviderSettingsCollection));

			properties = new ConfigurationPropertyCollection ();
			properties.Add (cacheRolesInCookieProp);
			properties.Add (cookieNameProp);
			properties.Add (cookiePathProp);
			properties.Add (cookieProtectionProp);
			properties.Add (cookieRequireSSLProp);
			properties.Add (cookieSlidingExpirationProp);
			properties.Add (cookieTimeoutProp);
			properties.Add (createPersistentCookieProp);
			properties.Add (defaultProviderProp);
			properties.Add (domainProp);
			properties.Add (enabledProp);
			properties.Add (maxCachedResultsProp);
			properties.Add (providersProp);
		}
		static CodeDomConfigurationHandler ()
		{
			default_compilers = new CompilerCollection ();
			compilersProp = new ConfigurationProperty ("compilers", typeof (CompilerCollection), default_compilers);
			properties = new ConfigurationPropertyCollection ();
			properties.Add (compilersProp);
		}
 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
     );
 }
        private static ConfigurationPropertyCollection EnsureStaticPropertyBag()
        {
            if (s_properties != null)
            {
                return(s_properties);
            }
            ConfigurationProperty propAppSettings = new ConfigurationProperty(null,
                                                                              typeof(KeyValueConfigurationCollection), null, ConfigurationPropertyOptions.IsDefaultCollection);
            ConfigurationProperty propFile = new ConfigurationProperty("file", typeof(string), string.Empty,
                                                                       ConfigurationPropertyOptions.None);

            ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection
            {
                propAppSettings,
                propFile
            };

            s_propAppSettings = propAppSettings;
            s_propFile        = propFile;
            s_properties      = properties;

            return(s_properties);
        }
Exemple #32
0
        private bool SetProperty(string PropName, string value)
        {
            ConfigurationProperty SetPropName = null;

            if (_properties.Contains(PropName))
            {
                SetPropName = _properties[PropName];
            }
            else
            {
                SetPropName = new ConfigurationProperty(PropName, typeof(string), null);
                _properties.Add(SetPropName);
            }
            if (SetPropName != null)
            {
                base[SetPropName] = value;
//                Parameters[PropName] = value;
                return(true);
            }
            else
            {
                return(false);
            }
        }
 protected internal virtual new bool ShouldSerializePropertyInTargetVersion(ConfigurationProperty property, string propertyName, System.Runtime.Versioning.FrameworkName targetFramework, ConfigurationElement parentConfigurationElement)
 {
     return(default(bool));
 }
 protected internal virtual bool ShouldSerializePropertyInTargetVersion(ConfigurationProperty property, string propertyName, FrameworkName targetFramework, ConfigurationElement parentConfigurationElement)
 {
     return(true);
 }
Exemple #35
0
        public void Add(string name)
        {
            if (((_thisElement.ItemLocked & ConfigurationValueFlags.Locked) != 0) &&
                ((_thisElement.ItemLocked & ConfigurationValueFlags.Inherited) != 0))
            {
                throw new ConfigurationErrorsException(SR.Format(SR.Config_base_attribute_locked, name));
            }

            ConfigurationValueFlags flags = ConfigurationValueFlags.Modified;

            string attribToLockTrim          = name.Trim();
            ConfigurationProperty propToLock = _thisElement.Properties[attribToLockTrim];

            if ((propToLock == null) && (attribToLockTrim != LockAll))
            {
                ConfigurationElementCollection collection = _thisElement as ConfigurationElementCollection;
                if ((collection == null) && (_thisElement.Properties.DefaultCollectionProperty != null))
                {
                    // this is not a collection but it may contain a default collection
                    collection =
                        _thisElement[_thisElement.Properties.DefaultCollectionProperty] as
                        ConfigurationElementCollection;
                }

                if ((collection == null) ||
                    (LockType == ConfigurationLockCollectionType.LockedAttributes) ||
                    // If the collection type is not element then the lock is bogus
                    (LockType == ConfigurationLockCollectionType.LockedExceptionList))
                {
                    _thisElement.ReportInvalidLock(attribToLockTrim, LockType, null, null);
                }
                else
                {
                    if (!collection.IsLockableElement(attribToLockTrim))
                    {
                        _thisElement.ReportInvalidLock(attribToLockTrim, LockType, null, collection.LockableElements);
                    }
                }
            }
            else
            {
                // the lock is in the property bag but is it the correct type?
                if ((propToLock != null) && propToLock.IsRequired)
                {
                    throw new ConfigurationErrorsException(SR.Format(SR.Config_base_required_attribute_lock_attempt,
                                                                     propToLock.Name));
                }

                if (attribToLockTrim != LockAll)
                {
                    if ((LockType == ConfigurationLockCollectionType.LockedElements) ||
                        (LockType == ConfigurationLockCollectionType.LockedElementsExceptionList))
                    {
                        // If it is an element then it must be derived from ConfigurationElement
                        if (!typeof(ConfigurationElement).IsAssignableFrom(propToLock?.Type))
                        {
                            _thisElement.ReportInvalidLock(attribToLockTrim, LockType, null, null);
                        }
                    }
                    else
                    {
                        // if it is a property then it cannot be derived from ConfigurationElement
                        if (typeof(ConfigurationElement).IsAssignableFrom(propToLock?.Type))
                        {
                            _thisElement.ReportInvalidLock(attribToLockTrim, LockType, null, null);
                        }
                    }
                }
            }

            if (_internalDictionary.Contains(name))
            {
                flags = ConfigurationValueFlags.Modified | (ConfigurationValueFlags)_internalDictionary[name];
                _internalDictionary.Remove(name); // not from parent
                _internalArraylist.Remove(name);
            }
            _internalDictionary.Add(name, flags); // not from parent
            _internalArraylist.Add(name);
            IsModified = true;
        }
Exemple #36
0
 protected void SetPropertyValue(ConfigurationProperty prop, Object value, bool ignoreLocks)
 {
 }
Exemple #37
0
 static IriParsingElement()
 {
     enabled_prop = new ConfigurationProperty("enabled", typeof(bool), false, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
     properties   = new ConfigurationPropertyCollection();
     properties.Add(enabled_prop);
 }
 public void Add(ConfigurationProperty property)
 {
     collection.Add(property);
 }
Exemple #39
0
 public void Add(ConfigurationProperty property)
 {
     Contract.Requires(property != null);
 }
Exemple #40
0
 protected internal object this [ConfigurationProperty property] {
     get { return(this [property.Name]); }
     set { this [property.Name] = value; }
 }
 protected void SetPropertyValue(ConfigurationProperty prop, Object value, bool ignoreLocks)
 {
     Contract.Requires(prop != null);
 }
Exemple #42
0
 static IdnElement()
 {
     enabled_prop = new ConfigurationProperty("enabled", typeof(UriIdnScope), UriIdnScope.None, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
     properties   = new ConfigurationPropertyCollection();
     properties.Add(enabled_prop);
 }
Exemple #43
0
 public void Add(ConfigurationProperty property)
 {
 }
Exemple #44
0
 internal PropertyInformation(ConfigurationElement owner, ConfigurationProperty property)
 {
     this.owner    = owner;
     this.property = property;
 }