You can use a DataSet to pass your data around between tiers. You can
use xsd.exe to generate DataSets which expose Product and ProductData's
properties. Also, because you get DataSets back from your queries, ou
don't have to do any of the packaging you are talking about.

I'm sure I've seen using DataSets for this purpose suggested in several
places in MSDN, but here's one page to get you started:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide
/html/cpconadonetarchitecture.asp

"Because the native serialization format of the DataSet is XML, it is an
excellent medium for moving data between tiers making the DataSet an
optimal choice for remoting data and schema context to and from an XML
Web service".

HTH,
G.


-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of
Anye M. Sellers
Sent: 27 April 2002 23:57
To: [EMAIL PROTECTED]
Subject: Best way to pass object between tiers


This isn't specifically a .NET question because it
could apply to any OO development but since I'm
developing in .NET I'm interested in the answer
specifically as it pertains to .NET.

If I have a class (we'll call it Product) that has a
number of scalar properties and a data access class
(we'll call it ProductData) that extracts the Product
data from the DB and then passes it back to Product,
is it better to stuff all the properties into a
Hashtable or ArrayList to send back to Product for initialization, or is
it better to initialize the Product from within ProductData and pass it
back?

On a similar vein, if I have a class ProductCategory
that contains properties of its own including a
collection of Product objects, is it better to pass
Product and ProductCategory objects between the
business and data access objects or to again parcel
them up as a collection and then pass them?

I'm not sure if there is a resource advantage to using
the Hashtable/ArrayList as opposed to
Product/ProductCategory, is there an inherent size
difference between Collection classes and custom
classes, and would this even matter if both the
Product and ProductData objects resided on the same
machine?

Sorry if this sounds scattered; I'm trying to come up
with a coherent standard to use in these situations
that I can document for my team.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to