in

Corey Roth and Friends Blogs

Group site for developer blogs dealing with (usually) Ionic, .NET, SharePoint, Office 365, Mobile Development, and other Microsoft products, as well as some discussion of general programming related concepts.

Not Necessarily Dot Net

March 2008 - Posts

  • Linq to SQL and enums

     This is really stupid, but it seems like enough of a stupid niche problem that it might be worth mentioning.

    There's an integer column in a database that maps to an enum. Whenever I tried to mark that enum as a column, I got an InvalidCastException (from deep within the Linq reflection-magic call stack). No useful information.

    So I wrapped an int property around that enum and specified that as the column.  Same result.

    After much frustrated googling, I double-checked the schema and realized that the column type was actually a bigint.  Even though the value was only 8, it couldn't even handle that much of a cast.

     

    Posted Mar 27 2008, 04:10 PM by JamesAshley with no comments
    Filed under: ,
2019.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems