I want to create a method passing a expression of type Expression<Func<T, string> to create expression of type Expression<Func<T, bool>> to filter a string property with the StartsWith, EndsWith and Contains methods like these expressions:
.Where(e => e.MiProperty.ToUpper().StartsWith("ABC"));
.Where(e => e.MiProperty.ToUpper().EndsWith("XYZ"));
.Where(e => e.MiProperty.ToUpper().Contains("MNO"));
the method should look like:
public Expression<Func<T, bool>> AddFilterToStringProperty<T>(Expresssion<Func<T, string>> pMyExpression, string pFilter, FilterType pFiltertype)
where FilterType is an enum type that contains the three of the mentioned operations (StartsWith, EndsWith, Contains)
Try this: