How do I ensure Linq to Sql doesn't override or violate non-nullable DB default values?

前端 未结 4 1652
天命终不由人
天命终不由人 2020-12-09 18:35

I have an SQL Server DB with a table with these fields:

  1. A bit with the default value 1, NOT NULL.
  2. A smalldatetime
4条回答
  •  长情又很酷
    2020-12-09 18:44

    You can create another file for your datacontext (partial class) and then use the InsertYOURENTITY and UpdateYOURENTITY partial methods to inspect your properties and assign the proper values. Call ExecuteDynamicInsert or ExecuteDynamicUpdate after your code and you're set.

提交回复
热议问题