public static IList<ConcreteActiveRecord> FindAll(Table t, string id_col)
        {
            var db = t.DB;
            var sql = "SELECT * FROM "+db.Delim(t.Name, DelimType.Table);
            var rows = db.ExecuteQuery(sql);

            var ret = new List<ConcreteActiveRecord>();
            foreach( var row in rows )
            {
                ret.Add( new ConcreteActiveRecord(t, id_col, row));
            }

            return ret;
        }
Beispiel #2
0
        public static Table Get(Database db, string name)
        {
            if (instances.ContainsKey(db))
            {
                if (instances[db].ContainsKey(name))
                    return instances[db][name];
                else
                {
                    var inst = new Table(db, name);
                    instances[db].Add(name, inst);
                    return inst;
                }
            }
            else
            {
                var inst = new Table(db,name);
                instances.Add(db, new Dictionary<string,Table>());
                instances[db].Add(name,inst);

                return inst;
            }
        }
Beispiel #3
0
        public static Table Get( Type type )
        {
            var info = Manager.GetInfoForType( type );
            var db_name = info.Attr.DatabaseName;
            var name = info.Attr.TableName;

            var db = Database.Get( db_name );
            if( instances.ContainsKey( db ) )
            {
                if( instances[db].ContainsKey( name ) )
                    return instances[db][name];
                else
                {
                    var inst = new Table( db, name );
                    instances[db].Add( name, inst );
                    return inst;
                }
            }
            else
            {
                var inst = new Table( db, name );
                instances.Add( db, new Dictionary<string, Table>() );
                instances[db].Add( name, inst );

                return inst;
            }
        }
 public ConcreteActiveRecord(Table t, string id_col, IDataRecord row)
     : base(t, id_col, row)
 {
 }
 public ConcreteActiveRecord(Table t, string id_col, long? id = null)
     : base(t, id_col, id)
 {
 }