我使用下面的代码:
private class WcfProxy<TService> :
ClientBase<TService> where TService : class, IContract
{
public TService WcfChannel
{
get
{
return Channel;
}
}
}
protected TResult ExecuteCommand<TResult>(Func<TContract, TResult> command)
where TResult : IDtoResponseEnvelop
{
var proxy = new WcfProxy<TContract>();
try
{
var result = command.Invoke(proxy.WcfChannel);
proxy.Close();
return result;
}
catch (CommunicationException ex)
{
proxy.Abort();
throw new BusinessException(BusinessExceptionEnum.Operational, Properties.Resources.Exception.WcfAdapterBase_CommunicationException_TransportInEnamDataIsInvalid, ex);
}
catch (TimeoutException ex)
{
proxy.Abort();
throw new BusinessException(BusinessExceptionEnum.Operational, Properties.Resources.Exception.WcfAdapterBase_TimeoutException, ex);
}
catch (Exception)
{
proxy.Abort();
throw;
}
}
当查询返回大量结果时,我遇到此消息:
通信对象无法用于通信,因为它处于故障状态
是否存在我成功观察数据库查询结果的方式或技巧,或者我划分结果或获取部分结果的方式?