CodeSmith Generator CSLA Templates Part 2: The Quick Start Tuesday, December 28 2010
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.
There are a couple of folders in the CodeSmith.CSLA folder
|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.
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.
Next right click the PetShop.UI project and select Set as Startup Project
Now when you select build or debug your project will start generating.
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.
After the manage outputs dialog comes up double click on the Entities.cst item.
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!