Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linq To Sql - SQL Default Constraint Problem

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?

like image 210
Ahmet Altun Avatar asked Dec 13 '22 22:12

Ahmet Altun


1 Answers

Set Auto Generated Value property to true in the designer.

Or IsDbGenerated="true" in .dbml file.

like image 154
Oleks Avatar answered Dec 26 '22 00:12

Oleks