Search code examples
npgsql

Convert hstore column to a XPO class property Npgsql 3.2.7


We have upgraded Npgsql from 2.2.5 to 3.2.7.

We have a database column of type hstore.

In 2.2.5 this column used to be converted by a XPO valueconverter from a string that came from the database to a List < Tuple< object, object>> that we wanted in a XPO class.

Before 3.2.7 something has changed and when we try to read this column, we get an error stating that "an object should implement IConvertible". But it does not state, which object should be IConvertible. I presume that this is the target XPO property, of type List< Tuple< object,object>>

We have tried to change the property to IConvertible but without effect.

Has anybody had similar problems with the hstore type and the 3.* upgrade?


Solution

  • I have no idea exactly what your application does (or how XPO works), but Npgsql 3.x returns PostgreSQL hstore as Dictionary<string,string>. It seems like your client code (XPO?) may be expecting the value returned by Npgsql to be IConvertible, which isn't the case anymore.