SelectMany support without needing to mantain the parameter name

Description

Hi,

var items = parent.SelectMany( x=>x.Items ).Where( x => x.Bla == 3 ).ToList() doesn't work. we need to specify the result selector just for knowing the alias name, so it needs the paramenter name to be maintained between expressions. so:

var items = parent.SelectMany( x=>x.Items, (p,r) => r ).Where( r => r.Bla == 3 ).ToList() works but

var items = parent.SelectMany( x=>x.Items, (p,r) => r ).Where( x => x.Bla == 3 ).ToList() doesn't

I can't see a reason why the alias is the parameter name. I mean, I can't find a scenario when this could be needed.
With criteria one can do something like
var c = session.CreateCriteria( type );
var p1 = c.CreateCriteria( "foo" ).Add( Expression.Eq( "XXXX", 5 );
var p2 = c.CreateCriteria( "bar" ).Add( Expression.Gt( "YYYY", 10 );

var result = p1.List<Foo>();

but with linq, we only have one single path, right? so, the queryable could have the "current path alias" and when SelectMany is called, change the alias.

Just to be sure, I changed the AssociationVisitor class for accepting only one path an every test were green.

I will be attaching a patch for this today or tomorrow, but first I want to know if I'm right with my train of thought.

Thanks

Environment

None

Activity

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created February 23, 2010 at 3:03 PM
Updated February 23, 2010 at 3:03 PM
Who's Looking?