开发者

Object Generated From Entity Model Does Not Create Nullable Foreign Keys

I have noticed some strange behavior when it comes to nullable foreign keys in my database. I have just started playing with the entity framework so I'm probably doing something wrong, but I cannot figure this one out.

Say I have the following two 开发者_运维问答tables: (CountryID is a foreign key that is nullable)

Object Generated From Entity Model Does Not Create Nullable Foreign Keys

When I create a new entity model I end up with this:

Object Generated From Entity Model Does Not Create Nullable Foreign Keys

But the CountryID properties are set to Nullable (None) - instead of True. Obviously this is a really trivial example, but with a large database it would be difficult switch all of these manually. Is there any way to have the entity framework use a nullable int? for these foreign keys?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜