Re: steps to get the samples to run (winforms and webforms only)

Re: steps to get the samples to run (winforms and webforms only)

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


tiago posted on Tuesday, November 13, 2012

Hi Mike,

Interesting point of vue that reminded me why I became interested on the code generation issue. At the time there were no "Using CSLA 4" ebooks. These ebooks provide comprehensive explanation of how to use CSLA. The 2005 and 2008 books were more about CSLA internals and Project Tracker was the major source of "how to" documentation.

Then CSLA 3.5.0 arrived bringing PropertyInfo - a new way of property handling. The code you had to write increased a lot in a way that seemed complex and error prone. Why do I have to write all this code? Snippets are a good  help but you need to have a good understanding  of CSLA concepts in order to put together a project that runs. What is the correct template for an EditableRoot? Is this method needed? Why is this method on the ProjectTracker and it's not on the stereotype template? Is my class going to fail if I don't include it?

A code generator can do it for you. A code generator "serves" you a full blown class ready to run, that can list and search the database, load and save objects and it can even declare business and authorization rules from your rule library. Looking at the generated classes you end up learning a lot about CSLA.

I thinks that there are two main areas you must master:

1) stereotypes - what is the use case of each stereotype

A good code generator (like the one I will promote at the end of this post) will validate stereotype relations and won't allow your EditableRoot object to be the child of any other object. So in fact you don't have to worry about this.

2) how to write business rules and how to write authorization rules

CSLA provides some very common rules but you will always need to write your custom rules. There are 2 libraries of rules around

- CSLA samples RuleTutorial

- CslaGenFork rules library

If you can't find there the rule you need, at least you will find plenty of samples you can analyse (and copy).

If you have a good understanding of these two CSLA areas, with the help of a good code generator your class will need minimal hand coding, most of the time none at all.

You can see how CslaGenFork generated code "tastes" like on the Csla sample ActionExtenderSample you can find on source control for 4.3.x

svn://svn.lhotka.net/csla/core/branches/V4-3-x/Samples/NET/cs/ActionExtenderSample

 

Concernig samples in general and WebForms samples, I must say CSLA has a very complete set of samples. I understand Rocky has no time no maintain samples of some technologies, namely WebForms. CslaContrib is the place where those samples can live. If you port some WebForms samples like PTWeb to Csla 4.3.13 or 4.5.x I think Jonny will be glad to include them on CslaContrib web site.

Copyright (c) Marimer LLC