我对以下代码有疑问:
private void DataPortal_Fetch(TaskCriteria criteria)
{
using (var ctx = ContextManager<Gimli.Data.GimliDataContext>
.GetManager(Database.ApplicationConnection, false))
{
this.RaiseListChangedEvents = false;
this.IsReadOnly = false;
IQueryable<Data.Task> query = ctx.DataContext.Tasks;
if (criteria.ReadyForPricing)
{
query = query.Where(row => row.IsPriced != true);
query = query.Where(row => row.Status == (int)TaskStatus.Closed);
query = query.Where(row => row.InvoiceId == Guid.Empty);
}
if (criteria.ReadyForInvoicing)
{
query = query.Where(row => row.IsPriced == true);
query = query.Where(row => row.Status == (int)TaskStatus.Closed);
query = query.Where(row => row.InvoiceId == Guid.Empty);
}
var data = query.Select(row => TaskInfo.FetchTaskInfo(row));
this.AddRange(data);
this.IsReadOnly = true;
this.RaiseListChangedEvents = true;
}
}
如果我不注释掉以下行,我的 Web 应用程序在调用此方法时总是挂起:
query = query.Where(row => row.InvoiceId == Guid.Empty)
知道为什么会发生这种情况吗?