开发者

Why doesn't the Entity Data Model Wizard produce an entity reflecting a db table with a default value of getdate()?

I have a database table where one of its columns is of type datetime. The default value for this column is set to getdate().

Using EDM wizard, I generate the entity model. Unfortunately, the generated entity model class does not set the column of a new row to the date on which the row is 开发者_Python百科created.

Why doesn't the EDM Wizard produce an entity reflecting a db table with a default value of getdate()?


The "default value" attribute on scalar members in EF models are for constant values only. What you need is setting StoreGeneratedPattern to "Computed" in order to indicate for EF that the column will get a value assigned db-side.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜