I had a quick look and there appears to be three issues here.
1. select e results in a ConstantExpression which contains a Lambda,
easy to fix
2. fixing 1, now it doesn't do a cross product of the two tables
3. ElementAtOrDefault is not implemented
Here is the test
[Test]
public void CanSelectOneFromMany()
{
var q = (from u in session.Linq<Timesheet>()
from uu in session.Linq<TimesheetEntry>()
select u).ToList();
Assert.AreEqual(18,q.Count);
}
That is far as I have gotten for now ...
On May 4, 6:16 am, Action Jackson <[email protected]> wrote:
> I'm trying to analyze a trivial Linq query and I'm getting a strange
> error that I can't figure out. Here is my query:
>
> var q = from e in Session.Linq<Employee>()
> from ei in Session.Linq<EmployeeInformation>()
> select e;
>
> object o = q.ElementAtOrDefault(0); // this my code that produces the
> issue
>
> I'm getting an InvalidCastException:
>
> Unable to cast object of type
> 'System.Linq.Expressions.ConstantExpression' to type
> 'System.Linq.Expressions.LambdaExpression'.
>
> The invalid cast occurs in the HandleSelectManyCall method within the
> RootVisitor class. The specifc line is below:
>
> //get the association path for the joined entity
> var collectionSelector = (LambdaExpression)LinqUtil.StripQuotes
> (call.Arguments[1]);
>
> Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"NHibernate Contrib - Development Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com.ar/group/nhcdevs?hl=en
-~----------~----~----~----~------~----~------~--~---