溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

UI5使用Association和Aggregation方法是什么

發(fā)布時間:2022-01-04 15:14:25 來源:億速云 閱讀:131 作者:iii 欄目:服務器

這篇文章主要介紹“UI5使用Association和Aggregation方法是什么”,在日常操作中,相信很多人在UI5使用Association和Aggregation方法是什么問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”UI5使用Association和Aggregation方法是什么”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

UI5

UI5使用Association和Aggregation描述控件之間的關(guān)系。

Aggregation:parent和子控件在lifecycle上存在依賴關(guān)系:

When a ManagedObject is destroyed, all aggregated objects are destroyed as well and the object itself is removed from its parent. That is, aggregations won't contain destroyed objects or null/undefined.

比如UI5的轉(zhuǎn)盤控件Carousel: 一旦轉(zhuǎn)盤被析構(gòu),里面顯示的page當然也沒有繼續(xù)存在的意義了,需要跟著被析構(gòu)。

UI5使用Association和Aggregation方法是什么

而Association描述了在lifecycle層面的一種soft dependency關(guān)系:

Managed associations also form a relationship between objects, but they don't define a lifecycle for the associated objects. They even can 'break' in the sense that an associated object might have been destroyed already although it is still referenced in an association.

最明顯的例子就是控件和其label的關(guān)系,比如button和label:技術(shù)上來說,可以彼此分開獨立存在。

UI5使用Association和Aggregation方法是什么

CRM

CRM的Genil model存在三種類型的relation,可以在doman CRM_RELATION_KIND里查看:

UI5使用Association和Aggregation方法是什么

UI5使用Association和Aggregation方法是什么

區(qū)別:

  • Association: Link between any kind of objects. Can also be defined across components with root or access object as target. 依賴關(guān)系最為loose的一種relation,可以用來連接跨model之間的節(jié)點。

  • Aggregation: Binds child objects to a root object. Only access and dependent objects can be aggregated. 只適用于同一模型的節(jié)點之間的關(guān)聯(lián)。

  • Composition: Like an aggregation, but composed child objects always exist. 特殊類型的Aggregation。目標節(jié)點的Cardinality為1或者1..n

S/4HANA

只有兩種:association或者composition。Composition的含義同CRM里的aggregation,而association的含義同UI5和CRM中的association一致。

UI5使用Association和Aggregation方法是什么

C4C

只有兩種: association或者composition。C4C的這兩種relation多了一個限制:relation的目標BO必須和源BO在同一個部署單元Deployment Unit,或者目標BO位于Foundation部署單元內(nèi)。

Association的語法如下圖:

UI5使用Association和Aggregation方法是什么

association的multiplicity只支持[0,1]或者[1,1], 如果不顯式指定,默認為[1,1].

C4C relation的一個特色是,一旦申明了一個子節(jié)點之后,系統(tǒng)會默認生成一個對應的composition。

下圖第4行代碼會自動生成一個[0,n]的從root節(jié)點到Item節(jié)點的composition。

UI5使用Association和Aggregation方法是什么

到此,關(guān)于“UI5使用Association和Aggregation方法是什么”的學習就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關(guān)知識,請繼續(xù)關(guān)注億速云網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI