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); }
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); }
public static DataTable Select(string selectSql, IDatabaseDrive dbDrive) { DataSet queryResult = dbDrive.ExecuteSelect(selectSql); return(queryResult.Tables[0]); }