Linq-to-SQL ignores SQL Server default value

后端 未结 6 1507
感情败类
感情败类 2020-12-15 17:59

When using Linq-to-SQL, adding a column to an existing table, and setting a default value on that new column, it seems that Linq to SQL ignores the default value. Has anyon

6条回答
  •  一生所求
    2020-12-15 18:16

    I've seen this. What you can do is go into the l2sql designer, view properties for the table column that has a default value. There is a property "Auto generated value", set that to true.

    This same value is set to true automatically for the identity column automatically, as in that case SQL Server is generating your row IDs.

提交回复
热议问题