I want to create expression.Equal() with ignore case. Sample code:
if (!string.IsNullOrEmpty(request.BrandCode))
{
MemberExpression me = Expression.Property(parmExpression, "BrandCode");
ConstantExpression constant = Expression.Constant(request.BrandCode, typeof(string));
expbrandCode = Expression.Equal(me, constant);
}
if (!string.IsNullOrEmpty(request.CountryCode))
{
MemberExpression me = Expression.Property(parmExpression, "CountryCode");
ConstantExpression constant = Expression.Constant(request.CountryCode, typeof(string));
expCountryCode = Expression.Equal(me, constant);
}
var finalexpression = Expression.AndAlso(expbrandCode, expCountryCode);
Pass the final expression into a method which accepts the expression.
I tried to create a Methodinfo for Tolower, passed it in Expression.Equal() and that didn't work.
Any guidence would be helpful.