实体框架 4.0 和视图中的空字段
我们正在向实体框架模型添加一些视图。这些视图中的某些字段在我们的 sql server 2k8 数据库中是可为空的 datetime2 数据类型,并且 edmx 错误地将这些字段显示为不为空。这是一个已知问题吗?
当我尝试将它们更改为非空时,它仍然会引发相同的错误 - 因为看起来 ssdl 的定义不同?
有人遇到过这个问题吗?
编辑:我的确切错误是:
“dateTimeAffected”属性 “V_myView”无法设置为 “空”值。你必须设置这个 属性为类型的非空值 '日期时间'
删除视图并将其添加回来也不能修复它......仍然将该字段标记为不可为空。
We're adding some views to our entity framework model. Some fields in these views are nullable datetime2 datatypes in our sql server 2k8 db and the edmx is incorrectly showing these fields as being not null. Is this a known issue?
When I try to change them to not null it still throws the same error - because it appears as if the ssdl is defining it differently?
Has anyone run into this problem?
Edit: My exact error is:
The 'dateTimeAffected' property on
'V_myView' could not be set to a
'null' value. You must set this
property to a non-null value of type
'DateTime'
Removing the view and adding it back in does not fix it as well... still marks the field as not nullable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
抱歉这个愚蠢的答案,但您确实删除了表并再次添加它们...由于某种原因 ef4 无法正确刷新它们...但是 ef4 不是一个已知问题,它应该将它们显示为可为空...顺便说一句什么错误你明白了吗?
Sorry for this silly answer but you did delete the tables and add them again...for some reason ef4 does not refresh them properly...but ya not a known problem with ef4 it should show them as nullable...btw what error are you getting?
你说该财产被标记为钥匙,
但从它的名字来看,情况似乎并非如此。
(将其标记为键当然不适合可空性......)
你有定义PK吗?
you said the property is marked as a key,
but by its name it doesnt sound like this is the case.
(having it marked as key of course dosent sit well with nullablility...)
do you have a PK defined ?