FreeVice
FreeVice

Reputation: 2697

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 do we need divide Product and Item?

Upvotes: 1

Views: 2035

Answers (2)

Dariusz Tarczynski
Dariusz Tarczynski

Reputation: 16731

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).

Upvotes: 6

Guillaume
Guillaume

Reputation: 22822

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.

Upvotes: 1

Related Questions