运行查询时出现以下错误:
System.NotSupportedException :成员“Application.Product.IsValid”不支持对 SQL 的转换。
以下查询有什么问题?
部分产品类别:
public Boolean IsValid
{
get { return this.isValid; }
set
{
isValid = value;
}
}
我有一个查询如下:
Table<Product> Producttable = dataContext.GetTable<Product>();
Table<ClientProduct> ClientProducttable = dataContext.GetTable<ClientProduct>();
var query =
from product in Producttable where product.IsValid == true
join clientProduct in ClientProducttable
on product.ID equals clientProduct.ProductID
where clientProduct.ClientID == clientID
orderby product.Name ascending
select product;
如果我这样做,我也会得到同样的错误
Table<Product> table = dataContext.GetTable<Product>();
IQueryable<Product> query =
from row in table
where row.IsValid == false
select row;
return query.ToList<Product>();