AhtolaDbHelper
A helper class that is being used to retrieve the schema information (columns, primary/identity key) of a Ahtola table.
This class implements IDbHelper for Ahtola. It queries pragma table_info(...) to build the list of DbField objects RepoDB uses internally to generate SQL statements.
Because pragma table_info doesn’t itself flag an autoincrement column, the identity column is instead detected by fetching the table’s original CREATE TABLE text from sqlite_master and scanning its column definitions for the AUTOINCREMENT keyword, or an INTEGER column also marked PRIMARY KEY (SQLite’s implicit rowid alias rule).
It also resolves the newly generated identity value via SELECT last_insert_rowid().
Like the other SQLite providers’ DbHelper, it takes its IDbSetting as an explicit constructor argument rather than resolving it internally.
It is automatically registered by AhtolaBootstrap — you do not need to instantiate it directly under normal use.
Constructors
public AhtolaDbHelper(IDbSetting dbSetting, IResolver<string, Type> dbTypeResolver)
Properties
| Name | Description |
|---|---|
| DbSetting | The IDbSetting instance used by this helper. |
| DbTypeResolver | The IResolver<string, Type> used to convert a Ahtola column data type (e.g. TEXT) into its equivalent .NET CLR type. AhtolaBootstrap supplies AhtolaDbTypeNameToClientTypeResolver. |
Usability
Only override this if you need a custom type resolver.
var dbSetting = new AhtolaDbSetting();
var dbHelper = new AhtolaDbHelper(dbSetting, new MyAhtolaDbTypeNameToClientTypeResolver());
DbHelperMapper.Add<SqliteConnection>(dbHelper, true);