J
Justin Dutoit
Hey gents. I have a technique I'm using in a pretty standard three-tier web
app: to show Customers to the user, I have a stored proc which queries the
customers table. The datatable is unpacked into a List<Customer> where the
Customer object has a property for each column of the db table. OK so far.
But now I want to show a shopping Basket, which contains columns from two
tables, Products and Purchases. Product Name comes from Products and the
number of Units in the basket comes from Purchases.
What I want is to have an object which contains all the properties from the
Product object and all those from the Purchase object. At the moment my
stop-gap is an object called ProductPurchase which inherits from Product and
manually adds the NumberOfUnits property the same as it is in Purchase. This
manually adding part doesn't seem right.
I want to continue using the List<object> in my app. What is the best way to
get organized? Can I get around the limitation where an object cannot have
two base classes? Or should I use a different approach...
Thanks in advance for your time
Justin Dutoit
app: to show Customers to the user, I have a stored proc which queries the
customers table. The datatable is unpacked into a List<Customer> where the
Customer object has a property for each column of the db table. OK so far.
But now I want to show a shopping Basket, which contains columns from two
tables, Products and Purchases. Product Name comes from Products and the
number of Units in the basket comes from Purchases.
What I want is to have an object which contains all the properties from the
Product object and all those from the Purchase object. At the moment my
stop-gap is an object called ProductPurchase which inherits from Product and
manually adds the NumberOfUnits property the same as it is in Purchase. This
manually adding part doesn't seem right.
I want to continue using the List<object> in my app. What is the best way to
get organized? Can I get around the limitation where an object cannot have
two base classes? Or should I use a different approach...
Thanks in advance for your time
Justin Dutoit