日期:2014-05-20 浏览次数:20874 次
var query = from record in db.XXXRecord
where record.Status==3 || record.Status==5 || record.Status == 8 || record.Status == 12
select record;
// Database.cs
public partial class XXXRecord
{
public bool IsValid
{
get
{
return Status==3 || Status==5 || Status == 8 || Status == 12;
}
}
}
// xxxx.cs
var query = from record in db.XXXRecord
where record.IsValid
select record;
public static IQuery<XXXX> MyFilter<XXXX>(this IQuery record)
{
return from x in query
where record.Status==3
------解决方案--------------------
record.Status==5
------解决方案--------------------
record.Status == 8
------解决方案--------------------
record.Status == 12
select x;
}