Khi sử dụng ADO.Net Data Services client để làm mới một thực thể bằng cách gọi LoadProperty
:Resource không tìm thấy cho phân khúc 'tài sản'
ctx.BeginLoadProperty(this, "Owner", (IAsyncResult ar) => ...
Nó ném một lỗi trên máy chủ nếu tài sản là null
Error: Exception Thrown: System.Data.Services.DataServiceException: Resource not found for the segment 'Owner'. at System.Data.Services.RequestDescription.GetSingleResultFromEnumerable(SegmentInfo segmentInfo) at System.Data.Services.DataService1.CompareETagAndWriteResponse(RequestDescription description, ContentFormat responseFormat, IDataService dataService)
at System.Data.Services.DataService1.SerializeResponseBody(RequestDescription description, IDataService dataService) at System.Data.Services.DataService1.HandleNonBatchRequest(RequestDescription description) at System.Data.Services.DataService`1.HandleRequest()
Vấn đề là khách hàng không biết tài sản là null
hoặc chưa được phổ biến. Chủ sở hữu sản phẩm là liên kết từ số Vehicle
đến số Customer
.
Bất kỳ ý tưởng nào sai?
Cảm ơn
[câu trả lời khác] này (http://stackoverflow.com/questions/505761/resource-not-found-for-segment-property/5987733#5987733) là một lựa chọn tốt hơn. Làm cho mã dễ đọc hơn. –