ClientTypeToAuroraDbTypeResolver

A class used to resolve a .NET CLR type into its equivalent AuroraDbType.

This IResolver<Type, AuroraDbType?> implementation converts a .NET CLR type into its equivalent RepoDb.Connector.AuroraDb.Npgsql.AuroraDbType (e.g. typeof(Guid) → AuroraDbType.Uuid, typeof(int) → AuroraDbType.Integer, typeof(byte[]) → AuroraDbType.Bytea).

There is no single CLR representation for the array types, the spatial (PostGIS) types, ltree, or NpgsqlRange<DateTime> (which could be a tsrange, a tstzrange, or a daterange) — an unresolvable type throws an InvalidOperationException.

Usability

var resolver = new ClientTypeToAuroraDbTypeResolver();
var auroraDbType = resolver.Resolve(typeof(int)); // AuroraDbType.Integer