CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

proper design - Order & OrderLineItemList

rated by 0 users
Answered (Verified) This post has 1 verified answer | 2 Replies | 1 Follower

Top 50 Contributor
178 Posts
Tim posted on Wed, Apr 4 2012 9:12 AM

From what I recall in my reading of the e-books, if you have an Order object, which also uses a list of line items, you would generally have a property of type OrderLineItemList (which in turn contains OrderLineItem objects).  Is this correct?

Is there any reason to consider exluding the OrderLineItemList from the Order object, and instead use a "getter" or UnitOfWork object to retrieve both of them together?  I ask because folks in my group are having that discussion.

As best I can tell, if an Order object is always going to consume line items, then a property of type OrderLineItemList should be included in the Order object.  I don't see a reason to create a wrapper ("getter") object that pulls both when the Order object could have referenced the OrderLineItemList in the first place.

Tim

Answered (Verified) Verified Answer

Top 10 Contributor
1,772 Posts
Verified by Tim

My vote is for having orderlineitems as a property of the order object. 

This way the order object can for calculations like OrderTotal, Discount and also know if any childh as broken rules.

Jonny Bekkum, Norway CslaContrib Coordinator

All Replies

Top 10 Contributor
1,772 Posts
Verified by Tim

My vote is for having orderlineitems as a property of the order object. 

This way the order object can for calculations like OrderTotal, Discount and also know if any childh as broken rules.

Jonny Bekkum, Norway CslaContrib Coordinator

Top 50 Contributor
178 Posts
Tim replied on Wed, Apr 4 2012 10:57 AM

Good point about the calculations.  I didn't mention that as I was discussing with my team.  I don't see what is gained by separatin them out, but having not used CSLA too long I don't want to assume that I know 100% the right way to go about it.  Thanks.

Tim

Page 1 of 1 (3 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems