Home > Net >  EF contain ()
EF contain ()

Time:12-19



Description:
In the table type varchar AuthorName field, if this field is no data (null), will be on the way of error,

My goal is to query the package does not contain a name in the field, please senior counsel,

CodePudding user response:

Books is empty,
Add an if you judge,
Of course, you can also write so, use?
 
Var b=books? The Aut...


In addition,
The method can also be changed to FirstOrDefault

CodePudding user response:

To do a null value judgment, or give a default value,
  • Related