May 18, 2010 03:11 PM|atconway|LINK
So I am thinking of creating a class clsBasketItem
One word of advice; drop the Hungarian notation or 'cls' in front of the class name. You can decipher the different object types in VS.NET fine without the prefix. No worries though, I see that a lot especially from old VB6 developers. In fact take the
following quote from the MSDN article below:
"Do not use Hungarian notation."
So I am thinking of creating a class clsBasketItem with properties pertaining to each item (code, description, qty etc etc), and then in my main clsBasket class fetching the cart contents from my SQL table into a collection of the clsBasketItem class - does
that sound right?
Well there are at least 100 different ways you could design the class. You could have an 'Items' class that reflects the items in the database that is displayed for the client. Then upon ordering 1..n items you could get each of the items data and have
a property on your 'Basket' or maybe more appropriately named 'Order' class of: List(of Items).
And the LINQ to objects will help me make specific queries against my object as required?
Yes as you become familiar with LINQ you will be able to query your objects if needed to produce a subset of results via a query directly into your class types, or into anonymous types as well. There is a lot of power with LINQ.
At this point I recommend getting your classes built and organized 1st to properly reflect your relational data and then begin the development for the interaction between the layers.