Best way to design shopping cart domain model on C#?
Google can`t help me. I find only this link: http://flylib.com/books/en/2.522.1.56/1/
So, once there is the question - why开发者_StackOverflow中文版 do we need divide Product and Item?
Product
is too complex to use it on your Cart
. We can imagine that Product
holds data about: Manufacturer, Quantities on Stock, Categories, etc. So the better way is to introduce an Item
that will hold only reference to real Product (for example ProductId) and Quantity (and others informations you need).
Google cannot write code for you, it doesn't know you. I suggest you ask your users exactly what they want, and just do it. In my experience (almost 20 years of coding), I've found that reinventing the wheel almost always takes less time in the long term than trying to use an existing wheel to fit into different specifications. All projects are unique.
Of course, you can take inspiration from what you find, but don't expect it to match your specifications.
精彩评论