日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SAP OData 的 V2 模型

發布時間:2023/12/19 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SAP OData 的 V2 模型 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文檔地址:

https://sapui5.hana.ondemand.com/#/topic/6c47b2b39db9404582994070ec3d57a2#loio66a130fa4d10411b8fc90df00185554b

The OData model is a server-side model, meaning that the data set is only available on the server and the client only knows the currently visible (requested) data. Operations, such as sorting and filtering, are done on the server. The client sends a request to the server and shows the returned data.

OData 模型是一個服務器端模型,這意味著業務數據只在服務器端可用,客戶端只維護了其當前發出請求后,服務器端返回的部分數據。圍繞數據進行的排序和過濾等操作,都是先在服務器端執行,再將執行結果返回給客戶端。

Requests to the back end are triggered by list bindings (ODataListBinding), context bindings (ODataContextBinding), and CRUD functions provided by the ODataModel. Property bindings (ODataPropertyBindings) do not trigger requests.

目前 OData 模型通過如下 API 觸發向后臺的數據請求:

  • List binding - ODataListBinding
  • context binding - ODataContextBinding
  • 增刪改查操作

The following two versions of the OData model are implemented:

  • sap.ui.model.odata.ODataModel
  • sap.ui.model.odata.v2.ODataModel.

The v2.ODataModel has an improved feature set and new features will only be implemented in this model.

sap.ui.model.odata.ODataModel is deprecated. We recommend to only use v2.ODataModel.

前者已經被標注成 deprecated 狀態,后者是 SAP 推薦使用的數據模型。

注意:OData V2 模型已經支持客戶端的排序和過濾了。

OData model 模型實例的創建方法:

var oModel = new ODataModel("http://services.odata.org/Northwind/Northwind.svc/"); var oModel = new ODataModel({serviceUrl: "http://services.odata.org/Northwind/Northwind.svc"});

當模型實例創建時,自動觸發獲取 OData 服務元數據的請求:

http://services.odata.org/Northwind/Northwind.svc/$metadata

Only the first model instance triggers a $metadata request. A JSON representation of the service metadata can be accessed by calling the getServiceMetadata() method on an OData model instance.

JSON 格式的服務元數據,通過模型實例的 getServiceMetadata 方法返回。

var oMetadata = oModel.getServiceMetadata();

In the v2.ODataModel, the service metadata is loaded asynchronously. It is not possible to load it synchronously. To get notified when the loading is finished, attach the metadataLoaded event.

對于 2.0 版本的 OData 模型來說,服務元數據采取一部方式加載,如果在應用程序里想捕捉元數據加載成功的事件,需要監聽 metadataLoaded 事件。

總結

以上是生活随笔為你收集整理的SAP OData 的 V2 模型的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。