4

I have a USER table in database. The table has a RegistrationDate column which has a default constraint as GETDATE().

When using LINQ, I don't provide any data for RegistrationDate column to make it default. But SQL Server raises error. I think LINQ tries to insert NULL into the column.

How can I make LINQ not to try to insert in the column RegistrationDate, because it has default value?

2 Answers 2

13

Set Auto Generated Value property to true in the designer.

Or IsDbGenerated="true" in .dbml file.

Sign up to request clarification or add additional context in comments.

Comments

0

I am not 100% sure, but you could make the property read-only in the DBML designer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.