SqLiteDbHelper
This class implements IDbHelper for SQLite. 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().
Unlike the other providers’ DbHelper classes, this one takes its IDbSetting as an explicit constructor argument rather than resolving it internally — this is what lets SqliteBootstrap wire it up against the Microsoft.Data.Sqlite-specific settings instance.
It is automatically registered by SqliteBootstrap — you do not need to instantiate it directly under normal use.
Constructors
public SqLiteDbHelper(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 SQLite column data type (e.g. TEXT) into its equivalent .NET CLR type. SqliteBootstrap supplies MdsSqLiteDbTypeNameToClientTypeResolver. |
Usability
Only override this if you need a custom type resolver — for example, to swap in SdsSqLiteDbTypeNameToClientTypeResolver when connecting through System.Data.SQLite.Core instead of Microsoft.Data.Sqlite.
var dbSetting = new SqLiteDbSetting();
var dbHelper = new SqLiteDbHelper(dbSetting, new SdsSqLiteDbTypeNameToClientTypeResolver());
DbHelperMapper.Add<SqliteConnection>(dbHelper, true);