在EF设计器datetime中设置默认值 [英] Set default value in EF designer datetime

查看:668
本文介绍了在EF设计器datetime中设置默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试设置datetime字段的默认值以获取当前时间。在SQL的字段设计器中,我将使用 getdate()。我应该在Entity Framework的设计师中使用什么?

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

推荐答案

StoredGeneratedPattern 设置为根据EDMX中的字段计算

您仍然在SQL Server中需要默认值,上述设置将确保EF荣誉。

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

这篇关于在EF设计器datetime中设置默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆