Replies: 3 comments
-
No DB-CLR type conversions occur at the level of this library. We're passing and retrieving data through Dapper. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarification @MoonStorm . |
Beta Was this translation helpful? Give feedback.
-
While in this particular case I'd recommend sticking to the basic primitive types (ie use an integer instead of an enum), I've started a section in the wiki about value mappings here. We can expand it later with other examples. |
Beta Was this translation helpful? Give feedback.
-
I have a C# class
Sample
, one of whose properties is an enum,TargetType
. I have a corresponding tablesamples
defined in a PostgreSQL database, along with a matching enum type,targettypes
.With Dapper.FastCRUD, I can retrieve records from the table successfully. However, I get an error during insertion:
Npgsql.PostgresException (0x80004005): 42804: column "target_type" is of type targettype but expression is of type integer
How do I tell Dapper.FastCRUD to map the C# enum TargetType to PostgreSQL targettype for inserts?
In my C# code, I've defined:
When using only Npgsql (and no ORM), I can successfully insert as follows:
Beta Was this translation helpful? Give feedback.
All reactions