C# linq成员不支持到SQL的转换

C# linq成员不支持到SQL的转换,c#,linq,C#,Linq,运行查询时,我出现以下错误: System.NotSupportedException:成员 “Application.Product.IsValid”没有支持的SQL转换 以下查询有什么问题 产品类别的一部分: public Boolean IsValid { get { return this.isValid; } set { isValid = value; } } 我的问题如下:

运行查询时,我出现以下错误:

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 Producttable=dataContext.GetTable();
Table ClientProducttable=dataContext.GetTable();
变量查询=
来自Producttable中的product,其中product.IsValid==true
在ClientProducttable中加入clientProduct
在product.ID上等于clientProduct.ProductID
其中clientProduct.ClientID==ClientID
按产品排序。名称升序
选择产品;
如果我这样做,我也会得到同样的错误

Table<Product> table = dataContext.GetTable<Product>();

        IQueryable<Product> query =
            from row in table
            where row.IsValid == false
            select row;

        return query.ToList<Product>();
Table Table=dataContext.GetTable();
可查询查询=
从表中的行开始
其中row.IsValid==false
选择行;
返回query.ToList();

使用
属性标记您的
属性是否有效


我相信,LINQtoSQL引擎需要有一个
column
属性才能查找数据库表。以及属性的参数,如ColumnName等。

使用
Column
属性标记
属性是否有效


我相信,LINQtoSQL引擎需要有一个
column
属性才能查找数据库表。以及(属性的)参数,如ColumnName或类似项。

尝试使用
where product.isValid==true
更改
where product.isValid==true
。(您引用了一个字段,现在您将引用一个属性)。作为补充说明,您可以使用属性快捷方式保存声明一个支持字段,因为getter和setter没有做任何异国的事情:
prop bool IsValid{get;set;}
@AgentFire实际上
==true
是多余的,只需执行
product.Isvalid
。尝试使用
where product.Isvalid==true
更改
where product.Isvalid==true
。(您引用了一个字段,现在您将引用一个属性)。作为补充说明,您可以使用属性快捷方式保存声明一个支持字段,因为getter和setter没有做任何异国的事情:
prop bool IsValid{get;set;}
@AgentFire实际上
==true
是多余的,只需执行
product.Isvalid