How to check if the value exist in the database table ignoring null in LINQ C# [duplicate]
问题 This question already has answers here : Why is EF generating SQL queries with unnecessary null-checks? (3 answers) Closed 11 months ago . I want to ignore null when the query check the value exist in database table in C# using LINQ and Lambda expression. Below line is checking null as well. When it finds null then ignore it. var nmcExist = db.AspNetUsers.Any(a => a.NMC_Number== model.NMC_Number); 回答1: You might be looking for 2 options: If null , return true .Any(a => a.NMC_Number == null ||