You can attach a ENUM Datatype to a sqlserver-table-field in Linq2SQL with global::Namespace and specify it's Server Data Type.
I have removed a table and a relationship to prior a ENUM instead. In Linq2Sql DataContext, the type is set to global::Namespace, NULLable=True and its corresponding server data type (small int).
Why am I get
InvalidOperationException The null value cannot be assigned to a member with type <Namespace> which is a non-nullable value type.
..when loading rows that have this value as null?
How about simply opening up the generated code and adding the '?' to the corresponding declaration? I know you had to do something similar some time ago to make sure Guid-fields would get db-generated values. (It supports it but Linq2Sql didn't add that parameter correctly..)
I completely agree with you, this is not recommended at all. But if you see no other solution than to change the generated code I would strongly recommend documenting it clearly somewhere as well, somewhere not in the generated code. I did not in the project I mentioned above, and a few months later I had to change something in the DB for a new version. Of course I didn't think about my changes to the auto generated code at the time and regenerated it, resulting in quite an impressive amount of errors, which was a little messy to sort out since I didn't exactly remember what I had changed earlier.. Good times, good times! :o)