资 源 简 介
优选方案是:PredicateExtensions 很方便,很强大 调用示例:public static void Test3() { DbDataContext db = new DbDataContext(); Expression> expressleft = PredicateExtensions.True(); expressleft = expressleft.Or(t => t.CategoriesID > 3); Expression> expressright = PredicateExtensions.False(); expressright = expressright.Or(t => t.CategoriesID < 5); expressleft = expressleft.And(expressright); var sql = db.GetCommand(db.TemplateDocument.Where(expressleft).Select(t => new { t.TemplateID, t.TemplateName, t.CategoriesID })).CommandText; Console.WriteLine(sql); }