Groups | Blog | Home
all groups > dotnet general > april 2005 >

dotnet general : Architetural Decisions


Bruno Rodrigues
4/10/2005 5:55:03 PM
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
Cor Ligthert
4/11/2005 12:00:00 AM
Bruno,


[quoted text, click to view]

I dont believe that this is the fastest while you can easily add to your
class where in are your orderdetais a method to get the sum of those. In
memory goes forever faster than any roundtrip to your database.

Just my thought,

Cor

AddThis Social Bookmark Button