Solved

Understanding CSLA...

Posted on 2006-07-03
5
468 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
ID: 17036167
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
ID: 17036675
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

920 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

17 Experts available now in Live!

Get 1:1 Help Now