简体   繁体   中英

Npgsql 6.x: How to find type mapping for CLR Type

In one of my projects I'm migrating Npgsql from 5.x to 6.x and I noticed that Npgsql.NpgsqlConnection.GlobalTypeMapper is missing Mapping property.

In 5.x I was using this property to find CLR type and get it's mapping to Postgres Type Name (PgTypeName). Now (in 6.x), when Mappings property is gone, I need to do it in other way. So, how it is possible in Npgsql 6.x to map CLR Type to Postgres Type Name?

You can instantiate an NpgsqlParameter, set its value to something, and then check its DataTypeName property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM