Open DarthStem opened 6 years ago
Could you please elaborate more on what's behind context.Citys
property? I'll try to reproduce it ASAP - it looks like the FirstOrDefault's inner predicate is not translated, or it just didn't reach the visitor.
Hmm. I've added two tests to reproduce the issue and it seems ok (see this commit 346206e).
One is the integration tests that uses a FirstOrDefault
with an inner predicate taken from another test - passes.
Another is for SPARQL query visitor that creates a SPARQL query from FirstOrDefault
with an inner predicate taken from another test - passes as well.
Could please give more details, i.e. runtime environment or explain what's behind that property I mentioned earlier?
Sorry, I neglected to sanitize my example. Hopefully this is clearer?
var fromLambda = context..AsQueryable<ICity>().FirstOrDefault(x => x.Name == cityName && x.Country.Name == countryName);
var fromLinq = (from x in context.AsQueryable<ICity>()
where x.Name == cityName
where x.Country.Name == countryName
select x).FirstOrDefault();
Assert.IsNotNull(fromLinq);
Assert.IsNotNull(fromLambda);
I'm seeing unexpected behavior when querying with LINQ versus a lambda expression.
From some test code...
fromLambda is always null but fromLinq is not null. My expectation was that they would both return the same city instance.
As background, I'm actually using a fork off of the alien-mcl/RomanticWeb fork which addressed Bug #69.