Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Question on design involving some Generics

Reply
 
Old 04-07-2008   #1 (permalink)
Chris


 
 

Question on design involving some Generics

Hi,
It's been a while. I am a bit stuck on deciding on how this should be done.
I need to retrieve orders and their order items and pass the result back as a
collection. I am aware on how to apply this to a point, but looking at my
code I am making quite a bit of calls befire getting my results. Is there any
way around this

Public Function GetOrders(parameters) as Generic.List(Of Order)

Dim _orders as New Generic.List(Of Order)

....getting data part

orderdr = dal.GetOrders(parameter)

While orderdr.read

order = new order(orderdr(id),orderdr(name),date,otherparameters)

--------Here is my issue. I have to call, for every order, the get items,so
if my orderdr has 1000 items, I have to then make 1000 calls to get the items.

order.items = dal.GetOrderItems(order.id)

_orders.Add(order)

End While

return _orders

Is there some other way around this and a common way it's usually done?

Thanks

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
OO design question .NET General
Re: Generics and comparison (follow on from my previous "Generics and collections" thread) .NET General
Re: Generics and comparison (follow on from my previous "Generics and collections" thread) .NET General
RTF Question: Is this a bug or by design? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46