Search code examples
entity-framework-4

Set default value in EF designer datetime


Trying to set the default value of a datetime field to take current time. In SQL's field designer i'd use getdate(). What should i use in Entity Framework's designer?

thx


Solution

  • Set 'StoredGeneratedPattern' to Computed against the field in the EDMX.

    You still need the default value in SQL Server though, the above setting will ensure EF honour's that.