Replies: 3 comments
|
No DB-CLR type conversions occur at the level of this library. We're passing and retrieving data through Dapper. |
0 replies
|
Thanks for the clarification @MoonStorm . |
0 replies
|
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. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have a C# class
Sample, one of whose properties is an enum,TargetType. I have a corresponding tablesamplesdefined 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 integerHow 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:
All reactions