Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource not found for segment 'Property'

When using ADO.Net Data Services client to refresh an entity by calling the LoadProperty:

ctx.BeginLoadProperty(this, "Owner", (IAsyncResult ar) => ...

It throws an error on the server if the property is 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()

Problem is that the client does not know whether the property is null or just hasn't been populated yet. The property Owner is a link from a Vehicle to a Customer.

Any ideas what's wrong?

Thanks

like image 481
gimpy Avatar asked Feb 03 '09 01:02

gimpy


1 Answers

Set IgnoreResourceNotFoundException property of the service context to true:

svc.IgnoreResourceNotFoundException = true;
like image 185
Pavel Chuchuva Avatar answered Oct 20 '22 18:10

Pavel Chuchuva