Due to my error message:
An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code Additional information: Conversion failed when converting the nvarchar value 'AB' to data type int.
I have an enumeration with an AB value, and I want to save it as an integer, not an nvarchar value. I have an enumeration with flag attributes: [Flags]
public enum VisibleDayOfWeek : int { None = 0, Monday = 1, Tuesday = 2, Wednesday = 4, Thursday = 8, Friday = 16, Saturday = 32, Sunday = 64 }
I cannot save several days in db, but I can save the sum of flag values ββthat represent several days.
I do not want to create an integer wrapper around these enumeration properties.
The main type of enumeration is a byte or an integer, so why is it stored as a string / varchar? It's pointless. Even the entity infrastructure has correctly handled enum support over the years ...
What is the solution in this case?
This guy seems to have the same problem: https://github.com/tapmantwo/enumflags
servicestack ormlite-servicestack
HelloWorld
source share