Using the IsNullOrWhiteSpace method in a linq statement will report an error,
Error message: System.NotSupportedException: ‘LINQ to Entities does not recognize the method ‘Boolean lsNullOrWhiteSpace(System.String)’ method, and this method cannot be translated into a store expression.’
You can use the method below to solve:
You can also use IsNullOrEmpty, IsNullOrEmpty method does not report an error, normal operation
The following figure is the analysis of these two methods: