using System; using System.Configuration; using BLToolkit.TypeBuilder; namespace BLToolkit.Configuration { internal class TypeFactoryElement : ElementBase { protected static readonly ConfigurationProperty _propSaveTypes = new ConfigurationProperty("saveTypes", typeof(bool), false, ConfigurationPropertyOptions.None); protected static readonly ConfigurationProperty _propSealTypes = new ConfigurationProperty("sealTypes", typeof(bool), true, ConfigurationPropertyOptions.None); protected static readonly ConfigurationProperty _propLoadTypes = new ConfigurationProperty("loadTypes", typeof(bool), false, ConfigurationPropertyOptions.None); protected static readonly ConfigurationProperty _propAssemblyPath = new ConfigurationProperty("assemblyPath", typeof(string), null, ConfigurationPropertyOptions.None); protected static readonly ConfigurationProperty _propVersion = new ConfigurationProperty("version", typeof(string), null, ConfigurationPropertyOptions.None); protected static readonly ConfigurationProperty _propKeyFile = new ConfigurationProperty("keyFile", typeof(string), null, ConfigurationPropertyOptions.None); public TypeFactoryElement() { _properties.Add(_propSaveTypes); _properties.Add(_propSealTypes); _properties.Add(_propLoadTypes); _properties.Add(_propAssemblyPath); _properties.Add(_propVersion); _properties.Add(_propKeyFile); } /// /// Gets a value indicating whether the /// will save generated assemblies to the disk. Default is . /// public bool SaveTypes { get { return (bool) base[_propSaveTypes]; } } /// /// Gets a value indicating whether the /// will seal generated types. Default is . /// public bool SealTypes { get { return (bool) base[_propSealTypes]; } } /// /// Gets a value indicating whether the /// will load types generated by BLTGen tool. Default is . /// public bool LoadTypes { get { return (bool) base[_propLoadTypes]; } } /// /// Gets a path to the global assembly. Default is . /// /// public string AssemblyPath { get { return (string) base[_propAssemblyPath]; } } /// /// Gets the version of global assembly. Default is . /// /// public Version Version { get { string strVersion = (string)base[_propVersion]; return string.IsNullOrEmpty(strVersion)? null: new Version(strVersion); } } /// /// Gets a path to the key file to sign global assembly. Default is . /// /// public string KeyFile { get { return (string) base[_propKeyFile]; } } } }