Click here to Skip to main content
15,906,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys
I am reading the database result and mapping it to my class objects
for example in a case like customer and customer orders, I read customer as a select command and the orders as a next result set of select command, on reader I move to next result set and map it to the collection of 'customerOrders' on 'customer' object. Till here its ok.

Problem: if i got 3rd result set which is like order transactions for each order of a customer.
Then what would be the good logic to map this 3rd result set in hierarchy to orders. Some way to read n rows in 3rd result set which is related to the Nth record in 2nd result set.

I am Doing this so that I can do following in my code.

orderTransaction[] transactions = customer.order[2].orderTransactions

Thanks for any ideas or logic.
Posted
Updated 15-May-11 16:32pm
v2

1 solution

It is not clear how and what framework you used to implement your application. But, if you are comfortable working with ADO Entity Framework[^] or NHibernate[^], such kind of query propagation is really easy. Just explore them.


I hope this helps you well.
 
Share this answer
 
Comments
saxenaabhi6 15-May-11 23:04pm    
Thanks Wonde, I am not allowed to use LINQ...
my application is on ASP.NET
dealing with an old legacy system having IDomian>domain>objects>ExtendedObjects>..blah blah.
Wonde Tadesse 21-May-11 23:03pm    
Sorry to here this. LINQ was awesome for your case.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900