开发者

Difference Between EntitySet and EntityRef

I want to know what really is the difference between EntitySet and EntityRe开发者_如何学Gof in LINQ-to-SQL. As per what I a seem to have understood, EntitySet is one-many or many-many relation and EntityRef is one-one. Correct me if I am wrong.


If the associated class is the many (child) side of a one-to-many relationship, the many class will be stored in a collection of the many classes, where the type of the collection is EntitySet , and T is the type of the many entity class. This collection will be a member variable of the one class.

If the associated class is the one (parent) side of a one-to-many relationship, a reference to the one class will be stored in a variable of type EntityRef , where T is the type of the one class. This reference to the one class will be a member variable of the many class.

therefore, EntityRef & EntitySet act one-to-Many relationship,EntitySet act the many in parent and EntityRef act as One in Child.


recently caught myself in the same doubts, so according to this answer you are right

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜