Store enum as string in database

后端 未结 3 762
隐瞒了意图╮
隐瞒了意图╮ 2021-02-01 22:59

I am experimenting with dapper. I have a class which has an enum and the values are stored as strings in the database.

This works with FluentNHibernate using GenericEnum

3条回答
  •  面向向阳花
    2021-02-01 23:12

    From the sample code I've just tried, it appears not. You can map an enum to its underlying integer value, but if you try to map it to its string value, a DataException is thrown.

提交回复
热议问题