CockroachDbDbTypeNameToClientTypeResolver

A class used to resolve a CockroachDB database type name into its equivalent .NET CLR type.

This IResolver<string, Type> implementation converts a CockroachDB database type name — as returned by information_schema.columns.data_type — into its equivalent .NET CLR type (e.g. character varying/text/jsonb → string, numeric/decimal → decimal, bytea/bytes → byte[], uuid → Guid, date → DateOnly, timestamp with time zone → DateTimeOffset). It is the default DbTypeResolver used by CockroachDbDbHelper.

The spatial (geometry, geography) and full-text search (tsquery, tsvector) types have no direct CLR representation. These, along with any other unrecognized type name, fall back to typeof(object).

Usability

var resolver = new CockroachDbDbTypeNameToClientTypeResolver();
var clrType = resolver.Resolve("uuid"); // typeof(Guid)