How do you store enums in sql-server using linq-to-sql?
I end up having a lot of conversions to and from int in my code.
There has to be a better way. What did I miss?
sqlItem.enumValue = (int)myEnumValue;
...
myEnumValue = (MyEnumType)sqlItem.enumValue
It does not matter if SQL server or LINQ stores the values as strings or ints in the database, I just want to avoid all these typecasts sprinkled all over my code.
Could it be solved by an extension method to my linq-to-sql-classes and if so what would that look like?