2 minute read

In Part 1: The Introduction was an overview of the CodeSmith Generator 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 Generator Studio and under the Frameworks node open the CSLA Folder.

CSLA Folder

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

Folder NameDescription
CommonContains the supporting CSLA assemblies and the Visual Studio templates to create the project.
CSharpContains the C# templates.
SourceContains the source code to the quick start and the API that the templates use.
VBDoesn’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.

CSLA QuickStart Template

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 Solution

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

PetShop Startup Project

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

PetShop Generated Solution

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 Manage Outputs

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

Edit Output - Entities

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 EditableChild 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!

Join the mailing list

Get notified of new posts and related content to your inbox. I will never sell you anything and I will NEVER sell your email address.