Many-to-many relationship / DataSet / child rows / DataRelation /sorting / navigation

  • Thread starter Thread starter Marco Ippolito
  • Start date Start date
M

Marco Ippolito

Hi,

I have a typical Products->OrderDetails->Orders type many-to-many
relationship expressed through a junction/x-ref table in a DataSet.

How do I get a DataView of relevant Orders starting from a given Product
row, using existing indexes and sorting results by an arbitrary column
belonging to the Orders table?

GetChildRows returns an array which I would need to sort separately with
Array.Sort, right? CreateChildView returns a DataView which I can sort
either directly or through my DataViewManager, but it won't sort the
intermediate results in the junction table based on a field from the
Orders table; again I would need to do that with some additional code,
right?

I would like to do this as elegantly as possible.

Do the Framework classes offer something like
"productDataRow.CreateChildView("many_to_many_relation_crossing_the_junction_table").Sort
= "SomeFieldFromOrdersTable" ?

Thanks very much for your help.
Marco
 
If the relation is already setup, GetChildRows will be insanely faster than
setting up DataRowViews.

I recently joined a team where there was heavy reliance on DataViews (web
based app). And I switched that in the base class to GetChildRows etc. and
got a 33% perf. increase.

- Sahil Malik
You can reach me thru my blog at
http://www.dotnetjunkies.com/weblog/sahilmalik
 
Back
Top