var Data = (from Client in _context.Client.Include(c => c.ClientType)
select Client);
Data = Data.Where(m => ... || (m.MobilePhone != null && String.Concat(m.MobilePhone.Where(c => !Char.IsWhiteSpace(c))) == search)).ToList();
This works if the mobilephone
is not null but errors out with a null reference exception if phonenumber
is null.
I have added the m.MobilePhone != null
condition but it seems like the normal AND
order is not being applied here so it doesn't stop the error.
I know I could convert to a list and then filter it but the number of results is to big for that.
Any suggestions about how to fix the error or another approach?
My above code is correct. It is working after an upgrade from EntityFrameworkCore.Sqlserver 2.1.3 to 2.1.14