My code:
i f(!string.IsNullOrWhiteSpace(gender))
if (gender == "NULL")
predicate = predicate.And(x => string.IsNullOrWhiteSpace(gender));
else
predicate = predicate.And(x => x.Gender == gender);
When gender is NULL and when I am executing the flowing line:
var filteredUsers = _personExtendedRepository.GetMany(predicate).ToList();
an error occurs:
“LINQ to Entities does not recognize the method ‘Boolean IsNullOrWhiteSpace(System.String)’ method, and this method cannot be translated into a store expression.”
Note:
When I am executing the following line in SQL Server Management Studio:
SELECT * FROM UVW_Sample WHERE Gender IS NULL
Records are displaying. Please help how to solve this issue.
string.IsNullOrWhiteSpacecannot be translated into SQL, so if you want to check whether column is null use something like: