recently I have used below query to get some filterded details from my table.
dbContext.ttable.Where(r => string.IsNullOrWhiteSpace(r.field))
but when I try to run above code snipped I got
“LINQ to Entities does not recognize the method 'Boolean IsNullOrWhiteSpace(System.String)' method, and this method cannot be translated into a store expression."”
after few minutes searching found the reason for that.
My query return type is IQueryable<ttable>.So this type is optimized to the deliver an optimized query.In this context all C# methods are not supported.There for I have to change the query like this and then it works
dbContext.table.where.(!(b.field == null || r. b.field.Trim() == ""))
No comments:
Post a Comment