Hey I have following code:
Func<Assoc, bool> predicate = (x) =>
(
!String.IsNullOrWhiteSpace(version) ? x.Version.Contains(version) : x.Version != null
);
var assocs = _context.Assoc
.Where(x => x.Model == model)
.Where(predicate)
;
But it doesn't work. If I try to execute this server gives me Internal Server Exception but if I change this to
var assocs = _context.Assoc
.Where(x => x.Model == model)
.Where(x => x.Version.Contains(version))
;
it works as I expect.
Why is that?
Is it possible to get preview of Linq generated query?