Hi,
I'm on my way to my first OOP-for-real project in C#, and having some big
trouble with code architeture.
I have four namespaces:
- Layout
- Info - Where I hold empty structs with business objects
- DB - Where I fill my Info objects
- Classes - Where I do all the business stuff with the return from DB
A snapshot from my database:
- Table Orders, Fields: ID, Date, ClientID
- Table OrdersDetails, Fields: OrderID, ProductID, Price, Quant, Discount
What I need, is to compute the total of an individual OrderDetail, and of
the entire order. I create this total fields with sum in sql, the fastest
way, and it's working nice.
But... This calc is bussiness logic, and it should be in my "Classes"
namespace, isn't that right? Cause if I have some special discount to apply,
for example, I'm in trouble. But, the only way to do this logic in the
"Classes" namespace, is looping through each object of the collection I have
already created - this sucks.
What concept I am misleading? What should I do?
Thanks in advance
Bruno Rodrigues.