I get an error
"Object must implement IConvertible."
When I
Database db = new Database(this.ConnStr, this.Provider);
var x = db.Fetch<myObj>(sql);//returns the error
and myObj has a
System.Data.Entity.Spatial.DbGeography
property. How can I correct this?
A PetaPoco maintainer here. The error is because PetaPoco doesn't know about the type and defaults to trying Convert.ChangeType(src, dstType, null);
, which is where I believe the error is originating from.
Please raise an issue over at the repo if you'd like support this type built-in.
A quick fix would be for you to implement your own converter logic. An example of this can be found in the SQLite integration test code . If you don't want to use the ConventionMapper or you're using an older version of PetaPoco, you can always register a customer mapper for the specific type. See the mapping docs for more information.
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.