Hi!
I wanted to construct dynamic Linq to Entities queries so I added the LinqToolKit which included this nifty library. The problem is that it doesn't seem to work for me. I have spent two days testing different things and it just won't work.
My Code:
The predicate is ignored and the output SQL returns ALL rows.Code:Return Await Task.Run(Function() Dim predicate = PredicateBuilder.True(Of PerformanceTest)() predicate.And(Function(e) e.TestTime = "201506161553") Dim res = db.PerformanceTests _ .AsExpandable() _ .Where(predicate) _ .ToList() Return res End Function)
When I remove AsExpandable and the predicate in the Where clause and add the expression directly, I get the 1 record as expected.
I am baffled as to why something as trivial as this refuses to work. Is it me who is doing something wrong, or what might be the problem?
I have already tested using Or methods, tested adding Compile() to the predicate but everything is without success.
This could save LOTS of code for us if it would just work.
VS2013
Entity Framework 6.1
VB.NET
regards
H




Reply With Quote