public static Expression <Func <T, bool> > And <T>(string[] keys, T t) { if (keys == null) { return(null); } var expression = EfUtils.True <T>(); for (int i = 0; i < keys.Length; i++) { var text = keys[i]; var expr = t.GetType().GetProperty(text); var val = expr.GetValue(t, null).ToString(); var type = expr.ToString(); if (text.ToLower().Equals("datetime") || text.ToLower().Equals("clientdatetime")) { expression = expression.And(EfUtils.AndIndexOf <T>(type, text, val)); } else { expression = expression.And(EfUtils.And <T>(type, text, val)); } } return(expression); }
public static Expression <Func <T, bool> > AndByGuid <T>(string key, Guid val) { if (string.IsNullOrEmpty(key) || val == null) { return(null); } var expression = EfUtils.True <T>(); expression = expression.And(EfUtils.AndByGuid <T>("Guid", key, val)); return(expression); }