I’ve been working on the CodeSmith Generator CSLA Templates periodically over the past few months at CodeSmith Tools. We have designed the templates from the ground up around the CSLA.NET Framework version 3.6.2. You might be thinking what’s the big deal it’s just another set of CSLA templates. You are mistaken, we have done a lot of research and gathered a lot of feedback. The end result is a streamlined CSLA experience that is highly customizable.
To start using the CSLA templates just navigate in the Template explorer to CodeSmith.CSLA and open the Quick start template. This will change once the templates have reached Release To Web. From here all you need to do is configure the namespaces and select your data source and click generate. CodeSmith will crunch statistics on your schema and generate a working CSLA solution based on your relationships. We know that this won’t be the default case for many of you but it does give you a great starting point to play with CSLA.
We have thought a lot about plug ability and generation customization. Each of the 14 template types (Criteria, EditableRoot, EditableRootList…) have been split up into three partial classes. For the simplicity of this walk through I’ll pick a database table called Account, it will have two generated partial classes Generated and DataAccess and another non generated partial class.
Account will be the name of the class and the name of the file will be Account.cs. The sole purpose of this partial class is to hold any class customizations and custom business rules.
Account.Generated.cs is the second generated partial class that holds all the properties and factory methods. This has been separated out so there is some separation when it comes to the Data Access portion of the class.
Account.DataAccess.cs is the third generated partial class and holds the DataAccess implementation for the business object. Currently there are two generation options for the data access: you can generate parameterized SQL or just the method stubs. In the future this will also include Object factory, Linq to SQL, or NHibernate.
Please stay tuned for more information and documentation on the CSLA templates. Please give us your feedback on what you think of our CSLA templates. We will also be releasing some VB.NET CSLA templates before version 1.0 has been completed.
Please stay tuned for part two where we go over customizing the templates and template features.
Continue to Part 2.
Share this post
Twitter
Facebook
Reddit
LinkedIn
Email