New to CSLA

New to CSLA

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


weebee posted on Tuesday, February 05, 2008

Good day,

I'm fairly nwe to implementing CSLA into an enterprise level application.
First off i was used to creating our own business objects in implementing our business layers (xml driven and usually dataset/datatable based), and this is the first time we'll actually be implementing a business layer framework (CSLA) and the learning curve is quite high that we're having performance issues with it (much more is how to properly implement the classes but more on that later).

now for my questions.

1. When should we inherit BusinessBase, ReadOnlyBase and ReadOnlyListBase? i mean the proper implementation of each.

2. we use the demo version of codesmith with the samples for CSLA 2.0, is this still applicable for CSLA 3.0 (and soon 3.5?)

3. we're also implementing WCF as endpoints for our applications, although CSLA supports WCF i noticed we have to decouple our business objects on the WCF end point and then couple them again on the consuming client, this adds additional while loops or for loops which is a performance issue on our applications. i understand that business objects shouldn't be serialized over the wire but usually we use XML serialization to pass data on the wire.

4. where can i find references for the settings on CSLA like "canReadProperty" or canwriteproperty and the impact of these objects to the application?

5. in an Architectural level, usually our busines frameworks resides only behind the webservices/WCF implementation, is it normal that we would implement CSLA on both the Business layer and Presentation Layer? (although for the UI layer we implemented Generic Lists to handle the data for bindings, this kind of feels like reinventing the wheel when we could use the same classes csla offers).

6. could you guys give me a link on a good code generator and template?

KKoteles replied on Tuesday, February 05, 2008

weebee,

Wow.  Where to start (which I guess is your question as well...).

1.  This thread gives you good information for getting started.  You would really need to check out Rocky's book (and the follow on e-books) to get the intial explaination of how to implement his objects:  http://forums.lhotka.net/forums/thread/21008.aspx

2.  I'm not really sure what is in the demo of CodeSmith anymore.  I never used those to begin with.  Here is a link off Rocky's site with respect to code generation:  http://www.lhotka.net/cslanet/codegen.aspx

3.  I'm a little confused by your question and I haven't really used WCF myself yet.  There are two ways to use the CSLA objects with respect to WCF / Web Services - either as a Data Portal channel to be used as a transport mechanism or as service.  Rocky goes into explaining the differences in his Using CSLA .NET Version 3.0 e-books (Chapter 1).  One of the key attributes to add to all CSLA objects is [Serializable] - so in CSLA's case the business objects are serializable.

4.  The best source for these settings is Rocky's book.  The link in #1 above explains where to find it.

5.  It depends on how you implement the framework (kind of ties into #3 above).  If you implement a Data Portal channel, then CSLA objects exist on both the client and app server.  If you implement a service (to allow others that may not implement CSLA access to data / information / services), then you may or may not have CSLA objects on the client - but you would on the server.  Even then, if you are the consumer of the service you can choose to implement CSLA object's.  Rocky demonstrates this example in his book - and the code is available off his web site.

6.  See the link in #2 above.

Welcome to CSLA,

Ken

ajj3085 replied on Tuesday, February 05, 2008

Well, your best bet is to buy the Expert C# / VB 2005 Business objects book.  That answers many of your questions.

I'm not sure what you are concerned about in #3; the DataPortal would handle moving your BOs from the client to the application server and back.  There's some code you need to write, but even much of this is going away in 3.5.

The "typical" Csla application has the UI using the BOs locally on the client, and the BOs talk either directly to the database, or can be sent to an application server where they talk directly to the database.  So UI layer -> business layer (Csla objects) -> data layer -> database

If you need another layer, you'd have something like this:

UI layer -> business layer (Csla objects) -> web services (DTO objects) // untrusted app

Web services (DTO objects) -> business layer (Csla objects) -> data layer -> database // trusted app

You'd only do that though if the UI layer lies outside of your trust boundry; that is, you have two applications.  So maybe this would be a client deployed to anyone on the internet.  You can trust any of the client code, so you need to duplicate your business layer on both ends (and they don't know about each other, because the web services layer sits in between).

HTH
Andy

weebee replied on Tuesday, February 05, 2008

thnkas for the replies, much appreciated.

currently our implementation is as follows.

DataLayer - CSLA- Data Portal

Business Layer - CSLA Business Objects

Web Services - WCF (as both Data Contract and service contract, the CSLA objects are turned ino List Arrays with another set of factory objects to manage the class schema.

Container Class for the UI - this also acts as a Business Layer to translate the objects returned by the service, the problem is this requires another set of factory objects which makes the application slower.

Actual UI - all the business guts removed and this is more less just filled with binding objects, presentation logic etc...

I tried a direct serialization of the CSLA objects in WCF but it seems there's a conflict on how it can be serialized, either i convert them to bytes and stream it out or i create Definition objects for each class and create an object List Array based on those classes (both are proccessing time extensive because of looping and/or a translation).

 

 

Copyright (c) Marimer LLC