CodeSmith CSLA templates - Part 2: The quick start

In Part 1: The introduction was an overview of the CodeSmith CSLA templates we are developing at CodeSmith. In this post, I am going to go over how to use the CSLA quick start and the new improvements resulting from customer feedback (Keep the feedback coming!).

First launch CodeSmith Studio and under the Frameworks node open CodeSmith.CSLA. The CSLA.NET folder will eventually be going away and replaced with our in house CSLA templates (CodeSmith.CSLA).

CodeSmith Studio 

There are a couple of folders in the CodeSmith.CSLA folder

Folder Name


Common Contains the supporting CSLA assemblies and the Visual Studio templates to create the project.
CSharp Contains the C# templates.
Source Contains the source code to the quick start and the API that the templates use.
VB Doesn’t exist yet but will contain the VB.NET templates.

Now double click on the quick start template, the property grid should now be populated with the quick start properties.

CodeSmith Studio (4)

Next select “” button for the Source Database property and select your database you wish to generate against. In this example I will select the PetShop database. The quick start will now populate the property grid most common settings. From here configure the settings to your liking and click generate. Microsoft Visual Studio should now launch unless you set Launch Visual Studio property to false.

PetShop - Microsoft Visual Studio (Administrator)

Next right click the PetShop.UI project and select Set as Startup Project

PetShop - Microsoft Visual Studio (Administrator) (3)

Now when you select build or debug your project will start generating.

PetShop - Microsoft Visual Studio (Administrator) (4)

The UI Project is a place holder project for you to start building your application. So now that you have the general idea on getting up and running quickly with the quick start lets see what it takes to customize the type of each entity. Lets right click the Entities.csp template and select Manage Outputs.

PetShop - Microsoft Visual Studio (Administrator) (5)

After the manage outputs dialog comes up double click on the Entities.cst item.

Edit Output - Entities.csp (2)

Earlier in the CSLA beta we had 14 different outputs instead of one. Now all the settings are in one output (Entities.cst). Say you wanted to change the types of your entities from an EditableRoot to a EditableRootChild object. Just use the familiar table picker and change it. It will check to make sure there is no conflict and that any child lists are populated. For example if you had no entities selected and you added a table to EditiableChild it would look through all the lists and if a list entity was not found it would add the table to the EditableChildList. This makes it extremely easy to configure your Business objects.

Please give us your feedback on the new CSLA templates!

Posted May 21 2009, 09:00 AM by Blake Niemyjski |
Filed under: ,


CodeSmith CSLA templates - Part 1: Introduction - Blake Niemyjski -; Posted on May 21 2009, 08:33 AM

Pingback from  CodeSmith CSLA templates - Part 1: Introduction - Blake Niemyjski -;

Top 50 Contributor
Joined on 06-17-2009
re: CodeSmith CSLA templates - Part 2: The quick start Posted on Jun 17 2009, 08:22 AM


thanks for the new template. It certainly is a whole lot simpler to manage than the previous csla template based on inlcude files.

However what is a bit confusing to me is that your template  seems to assume that for every business object  in a csla based application there is a corresponding database table. (i.e a 1-to-1 mapping between objects and tables). This will however rarely be the case. ( see e.g. the ProjectResource object in R.Lhotka's book. How would one create the ProjectResource object with your template? ) How can I map from tables to entities, if the ralationship is not 1-to-1 ?


Twitter Trackbacks for CodeSmith CSLA templates - Part 2: The quick start - Blake Niemyjski -; [] on Posted on Sep 01 2009, 10:31 AM

Pingback from  Twitter Trackbacks for                 CodeSmith CSLA templates - Part 2: The quick start - Blake Niemyjski -;         []        on;
Copyright © 2008 Windows Coding
Microsoft and Microsoft logo's are trademarks of Microsoft Corporation.