I don't think that fix will work with slightly more complex queries --
for instance:
this now works:
from s in session.Linq<Role>()
where s.ParentRole != null
select s;
but this query returns the wrong results:
from s in session.Linq<Role>()
where
s.ParentRole.Name != null
select s;
The fundamental issue lies in MemberNameVisitor.VisitEntity line 77:
if (expr.Type != _rootCriteria.GetRootType())
It will not create a subcriteria for the root type. This creates
problems for hierarchical queries like the one in the example.
My generic solution to the problem was trying to assign aliases to
each entity in the query in order to distinguish each EntityExpression
by alias rather than entity type. Although, that proved to be more
difficult than I originally estimated. I'll take a deeper look at it
this weekend.
As far as the DB functions go, not sure what happened to that
implementation. Those tests have been failing for a long time -- I
never took a look to see what was wrong.
On Jun 12, 12:01 pm, "Ayende Rahien" <
aye...@ayende.com> wrote:
> Fixed.
> Chadly, can you take a look and see if this is wrong somehow? I haven't
> touched the code in a while.
>
> Another issue, how are we implementing the functions in Linq?
> I am talking about things like this:
>
> var query = from e in db.Employees
> where db.Methods.Substring(e.FirstName, 1, 2) ==
> "An"
> select db.Methods.Left(e.FirstName, 3);
>