tags:

views:

44

answers:

1

I have a Linq-To-SQL mapping to a column in a SQL table.

This column is type DateTime with default mapping / binding of getdate().

The problem is that Linq-To-SQL tries to insert 12/1/0001 12:00 AM instead of letting SQL do its thing and insert getdate().

Is there a way around this?

Additionally, if the column is allowed to be null, why does 'Linq-to-SQL' try to insert a default value?

+1  A: 

This might help (scroll up a wee little bit). It talks of setting the IsDbGenerated and AutoSync properties, which tell the data context that the value is generated at the DB and how the value in the L2SQL object should be synced with the value in the database.

I think my google fu is low today, I'm positive I've read a good article/blog post about this, but I cannae find it again.

Dan F