AhtolaDbTypeNameToClientTypeResolver

A class used to resolve a Ahtola 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 Devolutions.Ahtola.Data.Sqlite driver. It is the default DbTypeResolver used by AhtolaDbHelper when initialized via AhtolaBootstrap.

Reflecting how Devolutions.Ahtola.Data.Sqlite reads back loosely-typed SQLite columns, boolean, char, date, datetime, none, string, text, time and varchar all resolve to string, while bigint, decimal, int, integer and numeric all resolve to long. blob resolves to byte[], double and real resolve to double, and any other type name resolves to object.

This mapping is the same as the one used by the Microsoft.Data.Sqlite-based MdsSqLiteDbTypeNameToClientTypeResolver of the SQLite provider.

Throws an ArgumentNullException when the type name is null.

Usability

var resolver = new AhtolaDbTypeNameToClientTypeResolver();
var clrType = resolver.Resolve("text"); // typeof(string)