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)
When I create a new entity model I end up with this:
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?
精彩评论