Quando si utilizza client di ADO.Net Data Services di aggiornare un'entità chiamando il LoadProperty
:Risorsa non trovata per il segmento 'Proprietà'
ctx.BeginLoadProperty(this, "Owner", (IAsyncResult ar) => ...
getta un errore sul server se la proprietà è 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()
Il problema è che il client non sa se la proprietà è null
o semplicemente non è stata ancora compilata. Il proprietario è un collegamento da Vehicle
a Customer
.
Qualche idea cosa c'è che non va?
Grazie
Questa [altra risposta] (http://stackoverflow.com/questions/505761/resource-not-found-for-segment-property/5987733#5987733) è un'opzione migliore. Rende il codice più leggibile. –