日期:2014-05-20 浏览次数:20992 次
void Main() { var queryResults = from c in dbContxt.customers let cloumns=dbContxt.ExecuteQuery<temp>("select name from syscolumns where id=object_id(N'customers')",""); where cloumns.All(d=>GetPropertyValue(c,d.name)=="T") select c; } public class temp { public string name{get;set;} } private static object GetPropertyValue(object obj, string property) { System.Reflection.PropertyInfo propertyInfo=obj.GetType().GetProperty(property); return propertyInfo.GetValue(obj, null); }