It is not null in an EntityFramework request

Entity Framework 4.0 code first, C # 4.0. What is wrong: is not null in the code?

var query = from c in dbContext.table where c.FacilityID == facilityID && c.FilePath is Not null select c; 

EDIT:

Many errors after adding are not null.

One of them:

Cannot find the type or namespace name 'Not' (are you missing using a directive or assembly reference?)

+6
source share
1 answer

Not not a keyword in LINQ queries, so you get compiler errors. You need to use the inequality operator ( != ) To check if FilePath .

The code below should work for you

 var query = from c in dbContext.table where c.FacilityID == facilityID && c.FilePath != null select c; 
+10
source

All Articles