管理 > OData Web サービス > OData でのエンティティ間のナビゲーションの有効化
  
OData でのエンティティ間のナビゲーションの有効化
定義済みのナビゲーションプロパティによってエンティティ間のナビゲーションが有効になっています。
ハードナビゲーション
以下の関連付けはコードでハード定義されています。
SeasonProductSeasons (containsTarget)
SeasonColorwaySeasons (containsTarget)
ProductSeasonSeason, Product
ColorwaySeasonSeason, Colorway
ProductProductSeasons (containsTarget), Colorways
ColorwayColorwaySeasons (containsTarget), Product
containsTarget が true の場合、これらのエンティティにエンティティセットは定義されません。これらのリソースへのアクセスはナビゲーションのみを介して行う必要があります。
ソフトナビゲーション
関連付けはタイプマネージャで定義されているオブジェクト参照属性に基づきます。終了エンティティタイプがエンティティデータモデルで定義されている場合、ナビゲーションを有効化すると、オブジェクト参照属性がナビゲーションプロパティになります。
既存のすべてのエンティティ ▶ creator(Principal), modifier(Principal), containerReference(Container) および (Colorwaycolor(Color) などに) 存在するすべてのエンティティ
$expand
$expand は、定義されているすべての利用可能なナビゲーションプロパティでサポートされ、ネストされた expand でもサポートされます。$expand$select$filter$orderby$expand$skip$top、および $count で機能します。 $expand ではアスタリスク (*) 文字とレベルオプションがサポートされています。
OData URL の例:
servicerootURL/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')?$expand=*,
ProductSeasons($expand=Season($select=seasonName)),
Colorways($expand=color($select=name))
応答の例:
{
"@odata.context": "$metadata#Products/$entity",
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_product_5f_LCSProduct",
"ID": "OR:com.lcs.wc.part.LCSPartMaster:150513",
"partPrimaryImageURL": null,
"floatAtt": 0,
"thePersistInfo_2e_createStamp": "2017-04-05T16:35:13Z",
"state_2e_state": "INWORK",
"productName": "MyProduct1",
"thePersistInfo_2e_modifyStamp": "2017-05-05T18:45:44Z",
"test1": null,
"drivenAtt": null,
"drivenAtt3": null,
"drivenAtt2": null,
"ProductSeasons": [
{
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_season_5f_LCSProductSeasonLink",
"ID": "VR:com.lcs.wc.product.LCSProduct:154613",
"placeholderStatus": "candidate",
"thePersistInfo_2e_createStamp": "2017-04-10T17:59:19Z",
"thePersistInfo_2e_modifyStamp": "2017-04-10T17:59:19Z",
"Season": {
"@odata.type": "#RFA.com_2e_ptc_2e_MySeason",
"@odata.id": "/Seasons('VR:com.lcs.wc.season.LCSSeason:154587')",
"seasonName": "Brand 2 Spring 2008"
}
},
{
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_season_5f_LCSProductSeasonLink",
"ID": "VR:com.lcs.wc.product.LCSProduct:150630",
"placeholderStatus": "candidate",
"thePersistInfo_2e_createStamp": "2017-04-05T16:55:37Z",
"thePersistInfo_2e_modifyStamp": "2017-04-05T16:55:37Z",
"Season": {
"@odata.type": "#RFA.com_2e_ptc_2e_MySeason",
"@odata.id": "/Seasons('VR:com.lcs.wc.season.LCSSeason:150484')",
"seasonName": "Brand 1 Spring 2008"
}
}
],
"Colorways": [
{
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_product_5f_LCSSKU",
"ID": "OR:com.lcs.wc.part.LCSPartMaster:154045",
"skuName": "blue",
"thePersistInfo_2e_createStamp": "2017-04-10T12:59:31Z",
"state_2e_state": "INWORK",
"thePersistInfo_2e_modifyStamp": "2017-04-10T12:59:31Z",
"color": {
"@odata.id": "/Colors('OR:com.lcs.wc.color.LCSColor:154017')",
"name": "blue"
}
},
{
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_product_5f_LCSSKU",
"ID": "OR:com.lcs.wc.part.LCSPartMaster:154106",
"skuName": "red",
"thePersistInfo_2e_createStamp": "2017-04-10T12:59:37Z",
"state_2e_state": "INWORK",
"thePersistInfo_2e_modifyStamp": "2017-04-10T12:59:37Z",
"color": {
"@odata.id": "/Colors('OR:com.lcs.wc.color.LCSColor:152591')",
"name": "red"
}
}
],
"iterationInfo_2e_modifier": {
"@odata.type": "#RFA.wt_2e_org_2e_WTUser",
"ID": "OR:wt.org.WTUser:11",
"name": "Administrator"
},
"iterationInfo_2e_creator": {
"@odata.type": "#RFA.wt_2e_org_2e_WTUser",
"ID": "OR:wt.org.WTUser:11",
"name": "Administrator"
},
"sizingDefinition": null,
"refProduct": {
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_product_5f_LCSProduct",
"ID": "OR:com.lcs.wc.part.LCSPartMaster:159522",
"partPrimaryImageURL": null,
"floatAtt": 1.1,
"thePersistInfo_2e_createStamp": "2017-04-12T14:48:27Z",
"state_2e_state": "INWORK",
"productName": "MyProduct4",
"thePersistInfo_2e_modifyStamp": "2017-04-12T16:31:51Z",
"test1": null,
"drivenAtt": null,
"drivenAtt3": null,
"drivenAtt2": null
}
}
ナビゲーション URL
odata.metadata=full がリクエストのヘッダに含まれているか URL でフォーマットとして指定されている場合、その応答には [email protected][email protected] のナビゲーション URL が含まれます。
OData URL の例:
servicerootURL/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')
応答の例:
{
"@odata.context": "$metadata#Products/$entity",
"@odata.type": "#RFA.com_2e_ptc_2e_MyProduct_24_com_5f_lcs_5f_wc_5f_product_5f_LCSProduct",
"@odata.id": "/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')",
"@odata.editLink": "/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')",
"ID": "OR:com.lcs.wc.part.LCSPartMaster:150513",
"partPrimaryImageURL": null,
"floatAtt": 0,
"[email protected]": "#DateTimeOffset",
"thePersistInfo_2e_createStamp": "2017-04-05T16:35:13Z",
"state_2e_state": "INWORK",
"productName": "MyProduct1",
"[email protected]": "#DateTimeOffset",
"thePersistInfo_2e_modifyStamp": "2017-05-05T18:45:44Z",
"[email protected]":
"#RFA.com_5f_2e_5f_ptc_5f_2e_5f_MyProduct_5f_24_5f_com_5f_5f_5f_lcs_5f_5f_5f_wc_5f_5f_5f_
product_5f_5f_5f_LCSProduct_25_test1_25_Enum",
"test1": null,
"[email protected]":
"#RFA.com_5f_2e_5f_ptc_5f_2e_5f_MyProduct_5f_24_5f_com_5f_5f_5f_lcs_5f_5f_5f_wc_5f_5f_5f_
product_5f_5f_5f_LCSProduct_25_drivenAtt_25_Enum",
"drivenAtt": null,
"[email protected]":
"#RFA.com_5f_2e_5f_ptc_5f_2e_5f_MyProduct_5f_24_5f_com_5f_5f_5f_lcs_5f_5f_5f_wc_5f_5f_5f_
product_5f_5f_5f_LCSProduct_25_drivenAtt3_25_Enum",
"drivenAtt3": null,
"[email protected]":
"#RFA.com_5f_2e_5f_ptc_5f_2e_5f_MyProduct_5f_24_5f_com_5f_5f_5f_lcs_5f_5f_5f_wc_5f_5f_5f_
product_5f_5f_5f_LCSProduct_25_drivenAtt2_25_Enum",
"drivenAtt2": null,
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/ProductSeasons",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/ProductSeasons/$ref",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/Colorways",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/Colorways/$ref",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/iterationInfo_2e_modifier",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/iterationInfo_2e_modifier/$ref",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/iterationInfo_2e_creator",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/iterationInfo_2e_creator/$ref",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/sizingDefinition",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/sizingDefinition/$ref",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/containerReference",
"[email protected]":
"/Products('OR:com.lcs.wc.part.LCSPartMaster:150513')/containerReference/$ref"
}