I have the following code:
return this.ObjectContext.BranchCostDetails.Where(
b => b.TarrifId == tariffId && b.Diameter == diameter
|| (b.TarrifId==tariffId && !string.IsNullOrWhiteSpace(b.Diameter))
|| (!b.TarrifId.HasValue) && b.Diameter==diameter);
And I get this error when I try to run the code:
LINQ to Entities does not recognize the method ‘Boolean
IsNullOrWhiteSpace(System.String)’ method, and this method cannot be
translated into a store expression.”
How can I solve this problem and write code better than this?
You need to replace
with
For Linq to Entities this gets translated into:
and for Linq to SQL almost but not quite the same