Understanding CSLA...

Understanding CSLA...

Old forum URL: forums.lhotka.net/forums/t/603.aspx


MyersA posted on Wednesday, July 12, 2006

I'm trying to understand the concept of CSLA (and using it with n-tier), but I'm having trouble with it (even after browsing Lhotka's book).
Let's say I have a webform (presentation layer) that will insert a product into the products table.  My webform instantiates my Products class (business layer), and calls addProduct(a,b,c,d, ...).  Products.addProduct creates and configures the SQLCommand to run the SP (data layer) that inserts to Products. Finally, the SP returns an error code (i.e. 0 or i) which another method in Products will interpret as "An error occurred" or "The Insert was successful".  This string will then be sent to the webform.
How do I add CSLA to this architecture?

Thanks.

vargasbo replied on Wednesday, July 12, 2006

Myers,

This is such a generic question, but if you download the example that Rocky has with his book you'll see how he's doing what you're looking for.

Regards,

david.wendelken replied on Wednesday, July 12, 2006

Ditto!  The ProjectTracker application you can download is a really well-crafted sample application.

Simple enough to get a handle on, but complex enough to see lots of common real-world situations being handled using the CSLA framework. 

Misled replied on Thursday, July 13, 2006

In CSLA, you will not be "Adding" products, the business object will be doing that for you per your DataPortal_XXXX methods. If there is an error, it will be returned to your client code and you can act accordingly. If no error is returned, then "The Insert was successful".  

This application framework is actually quite simple to use yet complicated enough to do anything you need to do. Read the book and implement it. You'll be impressed......

Copyright (c) Marimer LLC