세그먼트 '속성'에 대해 찾을 수없는 리소스
-
21-08-2019 - |
문제
Ado.net Data Services 클라이언트를 사용하여 LoadProperty
:
ctx.BeginLoadProperty(this, "Owner", (IAsyncResult ar) => ...
속성이있는 경우 서버에 오류가 발생합니다. null
오류 : 예외를 던지기 : System.Data.Services.DataserViceException : 세그먼트 '소유자'에 대해서는 찾을 수없는 리소스. at System.Data.Services.RequestDescription.getSingsingLerSultFromEnumerable (SectinInfo segmerInfo)의 system.data.services.dataservice1.compareetagandWriterSponse (requestDescription, contentformat responseformat, idataservice dataService)
at System.Data.Services.dataservice1.serializeresponsebody (requestDescription 설명, idataservice dataService) system.data.services.dataservice1.handlenonbatchRequest (requestDescription description) system.data.services.dataservice`1.handlerequest ()
문제는 고객이 부동산이 null
또는 아직 채워지지 않았습니다. 부동산 소유자는 a의 링크입니다 Vehicle
a Customer
.
어떤 아이디어가 잘못 되었습니까?
감사
해결책
기본 키에서 쿼리는 키가 존재하지 않을 때 예외를 생성합니다. 해결 방법은 조건에 더미 진정한 표현을 추가하는 것입니다 (예 : 1 == 1 && item.id == xxx).
더미 표현이 없으면 ado.net 요청은 다음과 같습니다.
http : //localhost//test.svc/role(xxx)
더미 상태의 경우 요청은 다음과 같습니다.
http : //localhost//test.svc/role() ?)?$filter=true 및 (id eq 1)
두 번째 경우에 예상되는 동작 (NULL 리턴)이 정확합니다.
다른 팁
세트 무시한 사람이 있습니다 True에 대한 서비스 컨텍스트의 속성 :
svc.IgnoreResourceNotFoundException = true;
"Segment 'Propertion'에 대해 찾을 수없는 리소스"오류도 받았습니다. 광산은 기본 키로보고있는 WHERE 절에서 그 것 같습니다. 존재하지 않는 기본 키를 사용할 때 (결과를 제공하지 않는 조항이 아닌) 기본 키를 사용할 때 오류가 발생한다고 말하는 리소스를 발견했습니다. 나는 비슷한 일이 자신에게 일어나고 있다고 생각합니다.