/// <summary> /// Constructor /// </summary> /// <param name="typeConverterSetup">Source of the settings</param> internal TypeConverter(TypeConverterSetup typeConverterSetup) { /* * Copy the settings */ this.converters = new Dictionary <string, Func <IComparable, IComparable> >(typeConverterSetup.GetConverters()); }
/// <summary> /// Constructor /// </summary> public DbContextBase() { var typeConverterSetup = new TypeConverterSetup(); var configurator = new Configurator(); this.OnConfiguring(typeConverterSetup, configurator); this.TypeConverter = new TypeConverter(typeConverterSetup); this.Configuration = new Configuration(configurator); var props = this.GetType().GetProperties(); foreach (var prop in props) { var value = prop.GetValue(this); if (value is TableBase) { var table = (TableBase)value; table.Initialize(this); this.tables.Add(table); } } }
/// <summary> /// Override this method in the child classes to change /// the configuration or to add new types. /// </summary> /// <param name="typeConverter">Use this to add new types</param> /// <param name="configurator">For changing the configuration</param> protected virtual void OnConfiguring(TypeConverterSetup typeConverter, Configurator configurator) { }