二维码

[其他] CRM BOL关系类型Association、Aggregation、Composition区别

Twilight发表于 2016-02-16 14:49lhx7300886 最后回复于 2017-03-03 09:09 [复制链接] 1151 1

BOL关系类型.jpg
  • Association
    is a relationship where all objects have their own life-cycle and there is no owner. Let's take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers but there is no ownership between the objects and both have their own life-cycle. Both can create and delete independently.
  • Aggregation
    is a specialize form of Association where all object have their own life-cycle but there is ownership and child object can not belongs to another parent object. Let's take an example of Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy. We can think about "has-a" relationship.
  • Composition
    is again specialize form of Aggregation and we can call this as a "death" relationship. It is a strong type of Aggregation. Child object dose not have their life-cycle and if parent object deletes all child object will also be deleted. Let's take again an example of relationship between House and rooms. House can contain multiple rooms there is no independent life of room and any room can not belongs to two different house if we delete the house room will automatically delete. Let's take another example relationship between Questions and options. Single questions can have multiple options and option can not belong to multiple questions. If we delete questions options will automatically delete.
回复

使用道具 举报

lhx7300886
研究的真是细致,我还没用到这些
回复 支持 反对

使用道具 举报

快速回帖

本版积分规则
您需要登录后才可以回帖 登录 | 注册有礼

快速回复 返回顶部 返回列表