-2
我下面這個例子什麼合適的方法來調用異步於化DataServiceQuery
http://msdn.microsoft.com/en-us/library/dd756367(v=vs.110).aspx
但我修改它看起來像這樣
public static void BeginExecuteCustomersQuery()
{
DataServiceQuery<ASHPersonify.OrderDetailInfo> query =
(DataServiceQuery<ASHPersonify.OrderDetailInfo>)
(SvcClient.Ctxt.OrderDetailInfos
.Where(a =>a.ShipMasterCustomerId == "pppp"
&& a.ShipSubCustomerId == 0
&& a.LineStatusCode == "A"));
try
{
query.BeginExecute(OnCustomersQueryComplete, query);
}
catch (DataServiceQueryException ex)
{
throw new ApplicationException(
"An error occurred during query execution.", ex);
}
}
public List<ASHPersonify.OrderDetailInfo> OnCustomersQueryComplete(IAsyncResult result)
{
// Get the original query from the result.
DataServiceQuery<ASHPersonify.OrderDetailInfo> query =
result as DataServiceQuery<ASHPersonify.OrderDetailInfo>;
return query.EndExecute(result).ToList();
}
,現在我收到此錯誤:
System.Collections.Generic.List<ASH_QIS.ASHPersonify.OrderDetailInfo>
has the wrong return type
就行了:
query.BeginExecute(OnCustomersQueryComplete, query);
什麼是正確的方式,如果它可能實現這樣的東西。
,願你有爲什麼有-2的解釋 – 2014-10-01 15:05:38