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
Chris [ Mo, 07 April 2008 06:45 ] [ ID #1936929 ]
Microsoft » microsoft.public.dotnet.general » Question on design involving some Generics

Vorheriges Thema: Are Activator/Remoting Proxies Thread-Safe?
Nächstes Thema: Help Favorites