using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; namespace SqlSugar { public static class CommonExtensions { public static List ToList(this T thisValue,Func action) where T:class,new() { return new List { thisValue }; } public static List ToList(this IEnumerable thisValue, Func action) where T : class, new() { return thisValue.ToList(); } public static IEnumerable WhereIF(this IEnumerable thisValue, bool isOk, Func predicate) { if (isOk) { return thisValue.Where(predicate); } else { return thisValue; } } public static IEnumerable MappingField(this IEnumerable thisValue,Func leftField, Func rightField) { return thisValue; } public static List MappingField(this T thisValue, Func leftField, Func rightField) where T:class { return new List() { thisValue }; } public static bool Any(this IEnumerable thisValue, List conditionalModels) { throw new Exception("Can only be used in expressions"); } public static IEnumerable Where(this IEnumerable thisValue, List conditionalModels) { throw new Exception("Can only be used in expressions"); } } } namespace System.Collections.Generic { public static class EnumerableExtensions { public static bool Contains(this IEnumerable thisValue, T likeKey, bool isNvarchar) { return thisValue.Contains(likeKey); } } }