comparison Source/Configuration/BLToolkitSection.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 using System;
2 using System.Configuration;
3 using System.Security;
4
5 namespace BLToolkit.Configuration
6 {
7 /// <summary>
8 /// Implementation of custom configuration section.
9 /// </summary>
10 internal class BLToolkitSection : ConfigurationSection
11 {
12 private const string SectionName = "bltoolkit";
13 private static readonly ConfigurationPropertyCollection _properties =
14 new ConfigurationPropertyCollection();
15
16 private static readonly ConfigurationProperty _propDataProviders =
17 new ConfigurationProperty("dataProviders", typeof(DataProviderElementCollection),
18 new DataProviderElementCollection(), ConfigurationPropertyOptions.None);
19 private static readonly ConfigurationProperty _propDefaultConfiguration =
20 new ConfigurationProperty("defaultConfiguration", typeof(string),
21 null, ConfigurationPropertyOptions.None);
22 private static readonly ConfigurationProperty _propTypeFactory =
23 new ConfigurationProperty("typeFactory", typeof(TypeFactoryElement),
24 null, ConfigurationPropertyOptions.None);
25
26 static BLToolkitSection()
27 {
28 _properties.Add(_propDataProviders);
29 _properties.Add(_propDefaultConfiguration);
30 _properties.Add(_propTypeFactory);
31 }
32
33 public static BLToolkitSection Instance
34 {
35 get
36 {
37 try
38 {
39 return (BLToolkitSection)ConfigurationManager.GetSection(SectionName);
40 }
41 catch (SecurityException)
42 {
43 return null;
44 }
45 }
46 }
47
48 protected override ConfigurationPropertyCollection Properties
49 {
50 get { return _properties; }
51 }
52
53 public DataProviderElementCollection DataProviders
54 {
55 get { return (DataProviderElementCollection) base[_propDataProviders]; }
56 }
57
58 public string DefaultConfiguration
59 {
60 get { return (string)base[_propDefaultConfiguration]; }
61 }
62
63 public TypeFactoryElement TypeFactory
64 {
65 get { return (TypeFactoryElement)base[_propTypeFactory]; }
66 }
67 }
68 }