0
이상한 문제가 있습니다. breeze 클라이언트 (C#)를 사용하여 데이터를 쿼리 할 때 단위 테스트에서 데이터가 정상적으로 처리됩니다. 내 WebApi 컨트롤러에서 동일한 코드를 호출하면 task.Result에 중단됩니다. 이 행동을 본 사람이 있습니까?breeze.sharp - taskResult.Result - 응답 없음
// This method when called from unit test works fine, but not from webApi:
public IEnumerable<ProductBaseInformation> GetProductBaseInformation()
{
var result = GetAllProductBaseInformation();
var productBase = result.Result; // GETS STUCK HERE..CODE NOT GOING FURTHER...
return productBase;
}
private async Task<IEnumerable<ProductBaseInformation>> GetAllProductBaseInformation()
{
_entityQuery = new EntityQuery<ProductBaseInformation>();
var products = await _entityManager.ExecuteQuery(_entityQuery);
return (IEnumerable<ProductBaseInformation>)products;
}
비동기 작업에서 async/await을 사용하는 것을 고려하십시오.) – lokusking
세부 사항에서 완료되었습니다 .... 이전에는 표시하지 않았습니다. 지금 async/await하고있는 부분의 코드 부분을 업데이트했습니다 ... 단위 테스트에서 작동합니다 ... 23,000 개의 행을 반환합니다 ... webApi 컨트롤러에서 GetProduceBaseInformation() 메서드를 호출하면 아무것도 수행하지 않습니다. – Deepak
비동기식으로 동기화를 수행하는 것처럼 보입니다. Thats는 안티 패턴입니다. 'GetProductBaseInformation'을 비동기로 만들고'await' GetAllProductBaseInformation을 만듭니다. 또한보십시오 [여기] (http://stackoverflow.com/a/22629216/4558029) – lokusking