Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5964845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:30:25+00:00 2026-05-22T19:30:25+00:00

You can attach a ENUM Datatype to a sqlserver-table-field in Linq2SQL with global::Namespace and

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:30:26+00:00Added an answer on May 22, 2026 at 7:30 pm

    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)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anyone help? I have an issue with linq2sql and trying to Attach (update)
Following on from this question I now have code that can attach to a
Does jquery/javascript have any event model that you can attach to your objects? Basically
I can attach a file with libesmtp? Does anyone have a sample code? Thanks
I have a problem I can not solve, when the GPS data logger is
I can attach a function to an element using .data() , but how can
I have a process suspended at breakpoint under visual studio debugger. I can attach
In SQL Server 2008 I can attach databases located only in its predefined folder
I known that with subversion you can attach arbitrary properties to each files. In
I read that the new delegate method can attach more than one event to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.