Thanks for the reply Jon. This helps a bit.
I'm having problems getting parent-child relationships to work now
though.
I have a single table with a "parent" column that relates to the "id"
column. I can't work out how to query that to get all the children of
an item.
Linq documentation seems to suggest I can create relationships with
the DataLoadOptions but I can't seem to get it working..
At the moment I have this, which is horribly inefficient:
List<uint> parents = new List<uint>();
uint current = obj;
while (current > 1){
var parent = from node in db.Objects
where node.OID == current
select node.Parent;
parents.Add(parent.First());
current = parent.First();
}
return parents;
Does anyone have an efficient way of doing this that actually works in
dbLinq?
Thanks
On Jul 27, 3:03 pm, Jonathan Pryor <[email protected]> wrote:
> On Sun, 2009-07-26 at 14:26 -0700, Monkey wrote:
> > I'm having troubles using SelectMany in this manner:
>
> > var allTeams = from t in leagues.SelectMany( l => l.Teams )
> > select t;
>
> > I get the following error:
>
> > The type arguments for method
> > 'System.Linq.Enumerable.SelectMany<TSource,TResult>
> > (System.Collections.Generic.IEnumerable<TSource>,
> > System.Func<TSource,int,System.Collections.Generic.IEnumerable<TResult>>)'
> > cannot be inferred from the usage. Try specifying the type arguments
> > explicitly.
>
> > Does anyone know a way around this? I'd be happy to specify the type
> > arguments explicitly as it asks, but I'm not really sure how that's
> > done.
>
> To specify type argument explicitly, do:
>
> leagues.SelectMany<LeaguesType, TeamType>(l => l.Teams)
>
> - Jon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DbLinq" 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/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---