Example #1
0
 protected ActiveRecord(string tableName, string primaryKeyName, DbLinkFactory factory)
 {
     TableName          = tableName;
     DatabaseDrive      = factory.CreateDatabaseDrive();
     DateTimeFormater   = factory.CreateDateTimeFormater();
     _fields            = new List <TableField>();
     _tableFieldManager = new TableFieldManager(this, DateTimeFormater);
     AddTableFieldsFromProperties();
     SetPrimaryKey(primaryKeyName);
 }
Example #2
0
        public void SetDatabaseConnection(DatabaseType databaseType, string connectionStr)
        {
            _databaseType = databaseType;
            DbLinkFactory factory = DbLinkGateway.CreateFactory(databaseType);

            DatabaseDrive = factory.CreateDatabaseDrive(connectionStr);

            _dataBaseFields        = new List <TableField>();
            _tableFieldPropertyMap = new TableFieldPropertyMap(this);
            CreateTableFields();
            _primaryKeyField = FindTableFieldByName(_primaryKeyName);
        }
Example #3
0
        public static DataTable Select(string selectSql, IDatabaseDrive dbDrive)
        {
            DataSet queryResult = dbDrive.ExecuteSelect(selectSql);

            return(queryResult.Tables[0]);
        }