Linq To Sql - SQL default constraint problem

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

When using LINQ, I do not provide any data for the RegistrationDate column to make it the default. But SQL Server is causing the error. I think LINQ is trying to insert NULL into a column.

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

+3
source share
2 answers

Install the constructor Auto Generated Valuein truethe constructor.

Or IsDbGenerated="true"in a file .dbml.

+11

100%, read-only DBML.

0

Source: https://habr.com/ru/post/1743488/


All Articles