要么await,要么wait
查询条件总是不管用,最后发现忘了写wait,服了。
写法1:
public override Expression<Func<AcctMubanZhuan, bool>> buildQueryWhere() { //查询条件 Expression<Func<AcctMubanZhuan, bool>> result = p => true; iPublicX.getPostedDataAsync<ParamQuery>(Request).ContinueWith((task) => { if (task.Status == TaskStatus.RanToCompletion) paramQuery = task.Result; if (paramQuery != null) { if (!string.IsNullOrEmpty(paramQuery.sType)) result = result.And<AcctMubanZhuan>(p => p.sType.StartsWith(paramQuery.sType)); } }).Wait(); return result; }
写法2:整个函数写成异步sync
await iPublicX.getPostedDataAsync<queryLedgerParam>(Request).ContinueWith(task => { param = task.Result; });

浙公网安备 33010602011771号