How to choose Business type?How to choose Business type?
Old forum URL: forums.lhotka.net/forums/t/9551.aspx
ddredstar posted on Saturday, September 18, 2010
Csla has so many different business types, how to decide which one should be the right one?
for example: EditableRootList and ReadOnlyList
i 'm a newbie of Csla.
Marjon1 replied on Saturday, September 18, 2010
Each business type is designed to handle certain situations, the best places to get yourself up to speed are:
- The CSLA book available in both physical and e-book form
- The CSLA videos (non-silverlight)
- The sample applications.
Basically the objects are broken into several categories:
- BusinessBase - Used for objects which are editable, have business (validation) rules and authorization
- BusinessListBase - Used to have a single list of BusinessBase objects and allow bulk saving of the list all at once.
- ReadOnlyBase & ReadOnlyListBase - Used to have read-only objects (i.e. grids, combo-boxes, etc), no business rules apply.
- NameValueList - A list that contains only two properties (key & value), can be useful for combo-boxes, etc.
- DynamicList or EditableListBase - Used only for very specific situations where you want immediate saves of objects while working within a grid, should be avoided where possible.
CSLA is an excellent framework, but is expected to used in a very different way that many programmers are used to; cannot recommend the book or videos enough if you are seriously looking at using it.
ddredstar replied on Sunday, September 19, 2010
BusinessListBase allow bulk saving. So, if don't have to bulk saving, ReadOnlyListBase is enough, right?
tiago replied on Sunday, September 19, 2010
Use ReadOnlyListBase only when you don't want to change and save the list items.
Suppose you have a price list.
- In the Sales Manager use case, he can change the prices, add new products, remove (or mark obsolete) some other products. In that use case, a BLB should be used.
- In the sales person use case, he just needs to get the product code, name, and price per unit. He can't change any of those. In this use case, a ReadOnlyListBase should be used.
You can have several objects referring to the same piece of data (products and prices). What matters is how you are going to use the objects. You can/should have as many objects as your use cases dictate.
ddredstar replied on Sunday, September 19, 2010
tiago
In the Sales Manager use case, he can change the prices, add new products, remove (or mark obsolete) some other products. In that use case, a BLB should be used.
if i add or update or delete one product each time, use ReadOnlyListBase to fill grid is enough, right? my reason is that i can use BusinessBase to process single product each time, am right?
tiago replied on Sunday, September 19, 2010
Please refer to
RockfordLhotka replied on Sunday, September 19, 2010
The stereotypes and base classes are also thoroughly explained in the first few chapters of Expert 2008 Business Objects, and in the Core 3.8 video series.
Copyright (c) Marimer LLC