Reputation: 13541
I have following tables:
Language
Id (bigint, primary key)
Name (nvarchar(100))
Code (nvarchar(2))
Article
Id (bigint, primary key)
LanguageCode (nvarchar(2), foreign key constraint to Language/Code)
...
My question: if I generate the model using entity framework 4, it doesn't generate the relation between Article/LanguageCode and Language/Code. Is this an entity framework limitation and should I also add LanguageId to Article table, or am I doing something totally wrong here?
Thanks!
Upvotes: 1
Views: 1932
Reputation: 60516
I think the problem is that Language.Code is not the Primary key of the Language class. In your model its allowed to have different Languages with the same Language.Code.
Another thing. From Business perspective its much better to have different articles depending on users culture, instead of language. Because a Language is not unique for a single culture, and all Business things like CurrencyFormat, DateFormat, Taxes and of course the Law are culture specific.
Upvotes: 3