| 0 | 1 using System; | 
|  | 2 using System.Configuration; | 
|  | 3 | 
|  | 4 using BLToolkit.TypeBuilder; | 
|  | 5 | 
|  | 6 namespace BLToolkit.Configuration | 
|  | 7 { | 
|  | 8 	internal class TypeFactoryElement : ElementBase | 
|  | 9 	{ | 
|  | 10 		protected static readonly ConfigurationProperty _propSaveTypes = | 
|  | 11 			new ConfigurationProperty("saveTypes",    typeof(bool),    false, ConfigurationPropertyOptions.None); | 
|  | 12 		protected static readonly ConfigurationProperty _propSealTypes = | 
|  | 13 			new ConfigurationProperty("sealTypes",    typeof(bool),    true,  ConfigurationPropertyOptions.None); | 
|  | 14 		protected static readonly ConfigurationProperty _propLoadTypes = | 
|  | 15 			new ConfigurationProperty("loadTypes",    typeof(bool),    false, ConfigurationPropertyOptions.None); | 
|  | 16 		protected static readonly ConfigurationProperty _propAssemblyPath = | 
|  | 17 			new ConfigurationProperty("assemblyPath", typeof(string),  null,  ConfigurationPropertyOptions.None); | 
|  | 18 		protected static readonly ConfigurationProperty _propVersion = | 
|  | 19 			new ConfigurationProperty("version",      typeof(string),  null,  ConfigurationPropertyOptions.None); | 
|  | 20 		protected static readonly ConfigurationProperty _propKeyFile = | 
|  | 21 			new ConfigurationProperty("keyFile",      typeof(string),  null,  ConfigurationPropertyOptions.None); | 
|  | 22 | 
|  | 23 		public TypeFactoryElement() | 
|  | 24 		{ | 
|  | 25 			_properties.Add(_propSaveTypes); | 
|  | 26 			_properties.Add(_propSealTypes); | 
|  | 27 			_properties.Add(_propLoadTypes); | 
|  | 28 			_properties.Add(_propAssemblyPath); | 
|  | 29 			_properties.Add(_propVersion); | 
|  | 30 			_properties.Add(_propKeyFile); | 
|  | 31 		} | 
|  | 32 | 
|  | 33 		/// <summary> | 
|  | 34 		/// Gets a value indicating whether the <see cref="TypeFactory"/> | 
|  | 35 		/// will save generated assemblies to the disk. Default is <see langword="false"/>. | 
|  | 36 		/// </summary> | 
|  | 37 		public bool SaveTypes | 
|  | 38 		{ | 
|  | 39 			get { return (bool) base[_propSaveTypes]; } | 
|  | 40 		} | 
|  | 41 | 
|  | 42 		/// <summary> | 
|  | 43 		/// Gets a value indicating whether the <see cref="TypeFactory"/> | 
|  | 44 		/// will seal generated types. Default is <see langword="true"/>. | 
|  | 45 		/// </summary> | 
|  | 46 		public bool SealTypes | 
|  | 47 		{ | 
|  | 48 			get { return (bool) base[_propSealTypes]; } | 
|  | 49 		} | 
|  | 50 | 
|  | 51 		/// <summary> | 
|  | 52 		/// Gets a value indicating whether the <see cref="TypeFactory"/> | 
|  | 53 		/// will load types generated by BLTGen tool. Default is <see langword="false"/>. | 
|  | 54 		/// </summary> | 
|  | 55 		public bool LoadTypes | 
|  | 56 		{ | 
|  | 57 			get { return (bool) base[_propLoadTypes]; } | 
|  | 58 		} | 
|  | 59 | 
|  | 60 		/// <summary> | 
|  | 61 		/// Gets a path to the global assembly. Default is <see langword="null"/>. | 
|  | 62 		/// </summary> | 
|  | 63 		/// <seealso cref="TypeFactory.SetGlobalAssembly(string)"/> | 
|  | 64 		public string AssemblyPath | 
|  | 65 		{ | 
|  | 66 			get { return (string) base[_propAssemblyPath]; } | 
|  | 67 		} | 
|  | 68 | 
|  | 69 		/// <summary> | 
|  | 70 		/// Gets the version of global assembly. Default is <see langword="null"/>. | 
|  | 71 		/// </summary> | 
|  | 72 		/// <seealso cref="TypeFactory.SetGlobalAssembly(string,System.Version,string)"/> | 
|  | 73 		public Version Version | 
|  | 74 		{ | 
|  | 75 			get | 
|  | 76 			{ | 
|  | 77 				string strVersion = (string)base[_propVersion]; | 
|  | 78 | 
|  | 79 				return string.IsNullOrEmpty(strVersion)? null: | 
|  | 80 					new Version(strVersion); | 
|  | 81 			} | 
|  | 82 		} | 
|  | 83 | 
|  | 84 		/// <summary> | 
|  | 85 		/// Gets a path to the key file to sign global assembly. Default is <see langword="null"/>. | 
|  | 86 		/// </summary> | 
|  | 87 		/// <seealso cref="TypeFactory.SetGlobalAssembly(string,System.Version,string)"/> | 
|  | 88 		public string KeyFile | 
|  | 89 		{ | 
|  | 90 			get { return (string) base[_propKeyFile]; } | 
|  | 91 		} | 
|  | 92 	} | 
|  | 93 } |