TursoDbHelper
A helper class that is being used to retrieve the schema information (columns, primary/identity key) of a Turso table.
This class implements IDbHelper for Turso. 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).
Compared with the other SQLite providers, it quotes the table name passed to pragma table_info(...), and matches the table name case-insensitively (COLLATE NOCASE) when it fetches the CREATE TABLE text from sqlite_master.
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 TursoBootstrap — you do not need to instantiate it directly under normal use.
Constructors
public TursoDbHelper(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 Turso column data type (e.g. TEXT) into its equivalent .NET CLR type. TursoBootstrap supplies TursoDbTypeNameToClientTypeResolver. |
Usability
Only override this if you need a custom type resolver.
var dbSetting = new TursoDbSetting();
var dbHelper = new TursoDbHelper(dbSetting, new MyTursoDbTypeNameToClientTypeResolver());
DbHelperMapper.Add<SqliteConnection>(dbHelper, true);