TursoDbTypeNameToClientTypeResolver
A class used to resolve a Turso database type name into its equivalent .NET CLR type.
This IResolver<string, Type> implementation converts a SQLite column data type name into its equivalent .NET CLR type, specifically for the Turso.Data.Sqlite.Provider driver. It is the default DbTypeResolver used by TursoDbHelper when initialized via TursoBootstrap.
Reflecting how Turso.Data.Sqlite.Provider reads back SQLite columns with stronger typing, date, datetime and time resolve to DateTime, decimal and numeric resolve to decimal, and bigint, int and integer resolve to long. boolean, char, none, string, text and varchar resolve to string. blob resolves to byte[], double and real resolve to double, and any other type name resolves to object.
Compare this with MdsSqLiteDbTypeNameToClientTypeResolver of the SQLite provider — for
Microsoft.Data.Sqlite,date/datetime/timeresolve tostringanddecimal/numericresolve tolong. Using the wrong resolver against a given driver will misrepresent these column types.
Throws an
ArgumentNullExceptionwhen the type name isnull.
Usability
var resolver = new TursoDbTypeNameToClientTypeResolver();
var clrType = resolver.Resolve("text"); // typeof(string)