Solved

Understanding CSLA...

Posted on 2006-07-03
5
467 Views
Last Modified: 2010-04-16
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.
P.S. - I always thought that in 3-tier architecture the data layer was another class that would make the actual call to the database . The business layer would only make sure that the data being sent to the data layer was correct and that the information sent to the windows/web form was user-friendly. Is that 4-tier architecture?
 
0
Comment
Question by:MyersA
  • 2
5 Comments
 
LVL 5

Expert Comment

by:pgloor
Comment Utility
Sorry, I cant help. You might consider posting your question here:
http://forums.lhotka.net/forums/5/ShowForum.aspx
0
 
LVL 5

Accepted Solution

by:
pgloor earned 100 total points
Comment Utility
Let me come back to your question and try to give an answer.

You probably have a 3-tier architecture with a Presentation layer, a Business Logic layer and a Data Access layer in mind. Extending this model to a 4-tier architecture typically extends the Business Logic layer into a Web server and an Application server part. UI and Data access remains the same.

Now, in CSLA the Business Object encapsulates both, the Business Data and the Business Rules. However, there is still strong logical separation of the data access code, since CSLA .NET specifically defines and requires the implementation of four data access methods in the business class:

DataPortal_Create
DataPortal_Fetch
DataPortal_Update
DataPortal_Delete

See the following link for details posted by Lhotka:
http://www.lhotka.net/Articles.aspx?id=b99dfec2-c079-4b85-98df-ea3582c28386

I don't know any details regarding CSLA and Stored Procedures. I know while the CSLA framework contains some support for the execution of Stored Procedures thru the DataPortal, Lhotka doesn't recommend the use of it.

See the following link for more information posted by Lhotka:
http://www.lhotka.net/Articles.aspx?id=2e980a8b-8bdf-4f83-ab18-12e40c6bb04d

I hope this helps a little for a better understanding. I'm still not sure whether to call this 3-tier or 4-tier (or even 2-tier in some cases without SP).
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now