Example #1
0
 public Database(DbSettings settings, DbTrait trait, ILogger logger, IMetaFactory metaFactory = null)
 {
     this.Settings    = settings;
     this.Trait       = trait;
     this.MetaFactory = metaFactory ?? DbClassFactory.Default;
     _DbSets          = new ConcurrentDictionary <string, IDbSet>();
     this.Logger      = logger ?? Itec.Logs.Logger.Default;
 }
Example #2
0
        public DbSet(Database db, IMetaFactory classFactory = null) : base(classFactory ?? DbClassFactory.Default)
        {
            this.Database = db;

            this.DbClass = this.MetaClass as IDbClass;
            FieldedSqls  = new ConcurrentDictionary <string, SQLs.SQL <T> >();
            this.Sql     = new SQLs.SQL <T>(string.Empty, db, this.DbClass);
            //this.FieldedSqls.TryAdd(null,this.Sql);
            this.FieldedSqls.TryAdd("", this.Sql);
            this.FieldedSqls.TryAdd("*", this.Sql);
        }
Example #3
0
        /// <summary>
        /// Register a new factory
        /// </summary>
        /// <param name="name"></param>
        /// <param name="factory"></param>

        public static void RegisterFactory(
            string name,
            IMetaFactory factory)
        {
            MetaTableFactoryRef mtfr = new MetaTableFactoryRef();

            mtfr.Name             = name;
            mtfr.MetaTableFactory = factory;
            MetaFactories.Add(mtfr);
            return;
        }
Example #4
0
 public Data(T data, IMetaFactory metaFactory = null)
     : this(() => data, metaFactory)
 {
 }
Example #5
0
 public Data(Func <T> getObject, IMetaFactory metaFactory = null) : this(metaFactory)
 {
     GetObject = getObject;
 }
Example #6
0
        protected Data(IMetaFactory metaFactory = null)
        {
            var factory = metaFactory ?? MetaFactory.Default;

            this.MetaClass = factory.GetClass <T>();
        }
Example #7
0
 public MetaClass(Type type, IMetaFactory factory = null)
 {
     this.Type = type;
     //this.GetConfig = configGetter;
     this.Factory = factory;
 }
Example #8
0
 public MetaClass(IMetaFactory factory) : base(typeof(T), factory)
 {
 }