Entity Framework ISNULL in Where condition

Usman Khalid picture Usman Khalid · Dec 19, 2013 · Viewed 16.6k times · Source

I have a Query in SQL Server :

SELECT * FROM MyTable t
WHERE ISNULL(t.Status,'') = ''

How I can do it in Entity Framework?

EDIT: Oh Sorry my code was like

WHERE ISNULL(t.Status,'') = ''

Answer

TJ Bandrowsky picture TJ Bandrowsky · Dec 19, 2013

Try something like

MyTable.Where( t => (t.Status ?? "") == "CO" )