Linq unidirectional one-to-many association
I have a typical Parent contains many Children (List) relationship. 开发者_C百科 How do I tell the DBML designer to insert a Parent property in Child while leaving out the Children property in Parent? I only want a one way association.
Right click on the association arrow. Select Properties In the Properties panel, change Child Property to False.
When Visual Studio imports tables foreign key relationships into edmx file, it creates both Children navigation property on Parent object and Parent navigation property on Child object.
After that you can open edmx file in designer and manually delete Children property from list of Navigation Properties of Parent object.
精彩评论