Open xuzhg opened 3 years ago
Investigation:
1) we should public this https://github.com/OData/odata.net/blob/master/src/Microsoft.OData.Core/ODataNestedResourceInfo.cs#L97 . So customer can set the context uri
2) we should change the logic at: https://github.com/OData/odata.net/blob/master/src/Microsoft.OData.Core/JsonLight/ODataJsonLightWriter.cs#L990-L994
3) We maybe add "public Func<Uri, IEdmModel> ContextUriEdmModelFunc;" into reader/writer setting to provide the edm model for a certain context Uri.
We are upgrading our OData libs from 6.15.0 to 7.7.2 for better webapi2 integration and features supported in latest version. I have handled all the cases like you suggested before. But I noticed that context URI is missing when I use $expand functionality. For example: "RecipientPermission@odata.context" is missing in below payload using Microsoft.OData.Core 7.7.2. Here Recipient, and RecipientPermissions are entity types. URI: https://10.128.4.68/adminapi/beta/vg.extest.microsoft.com/Recipient('fc44eae0-4a01-4c6c-9c0d-35933ed53894')?$expand=RecipientPermission&$select=ExternalDirectoryObjectId
Investigation:
I investigated it and it seems related to this commit:
https://github.com/OData/odata.net/commit/b214dbfde938edf765a7fe8132ce4d5732995ac4#diff-a357b7f405d3fce1a2b3960daab3b0bf2cdba1a7af09a09e05b8df6511b87ade as below