Code generation and tutorial on howto use code generation tool

Code generation and tutorial on howto use code generation tool

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


g18c posted on Saturday, July 07, 2007

I've written my 1st CSLA app by coding my business objects by hand to learn the code structure. However, in future i would like to use code generation to automatically create at least parts of the business objects for me. The problem is i dont know where to start, what tools to use, im at a dead end. I have heard about codesmith but havent a clue on howto use it.

Could someone kindly tell me which is the best code generation software to use for CSLA, and ideally point me in the direction of a tutorial on howto use it.

Many thanks in advance,

Chris

triplea replied on Saturday, July 07, 2007

Codesmith is probably your best bet. I tried it recently with no prior experience and its is really easy. Just download CSLA Contrib (http://www.codeplex.com/CSLAcontrib) which contains templates that cover most of your scenarios and are easy to use and modify.

Philip replied on Thursday, July 19, 2007

Try Code Complete .NET. I am pretty sure it will provide what you need. It has saved me days of development and it generates fully functional .NET three tier applications based on the CSLA.NET framework.

Here is the link: http://www.xmlgateway.co.uk

 

Philip

JonStonecash replied on Saturday, July 07, 2007

The problem with the word "best" is that it implies that you have some standard against which are going to evaluate the various code generation tools that are available.  Since you are just starting out with code generation, it is likely that you have no clear idea about what those standards should be.  What I would suggest to you is that you should get a free code generator and play with it in order to gain the necessary experience that would lead to the formulation of your requirements for code generation.

I have used code generation for a number of my projects.  I have a number of preferences for how I think code generation should be done.  The most important aspect is that the code generation be template-based and that I can control the contents of the templates.   While CSLA provides a general framework for the development of database centric applications, there can be major differences in how the various aspects of CSLA are implemented.  CSLA can be implemented in C# or VB.NET.  There are different versions of CSLA.  There are different versions of the database that you might use.  The list goes on.

I am currently working on a CSLA 2.1.4 project in which I am using MyGeneration
to generate VB.net code.  MyGeneration is "free" but there are, as with any code generation tool, significant adaptation costs.  MyGeneration comes with some CSLA templates, but they are not up-to-date and may not be in the language that you need.  I have spent a lot of time adapting those templates and integrating material from previous projects and from other CSLA templates that are available.  In a very real sense, these templates are my design scratchpad in which I have worked through most of the significant design decisions that had to make on this project.

The bottom line of my advice is that you go get a code generation tool such as MyGeneration and just start to use it.

Jon Stonecash

g18c replied on Saturday, July 07, 2007

Ok ill check out MyGeneration. I did remember seeing a short tutorial on Codesmith and CSLA a while back (downloading a free old version or something?) but i cant for the life of me remember it nor can i find a link in google (tried searching for the past 10 minutes but no luck).

I will try jumping in at the deep end but i always like to at least read a little before i take the plunge! Any links or even the url to the codesmith csla tutorial i remember would be very much appreciated.

Cheers

g18c replied on Saturday, July 07, 2007

I just found the tutorial on http://www.onelittlevictory.com/. thanks for the advice.

RichMark replied on Friday, July 20, 2007

I recently uploaded MyGeneration templates for CSharp.  You might try them.  I also uploaded a sample app for the Northwind database.  These are available under CSLAContrib on Codeplex.

xal replied on Monday, July 23, 2007

You can also try CslaGenerator.
http://groups.google.com/group/CslaGenerator

Andrés

ozitraveller replied on Friday, July 27, 2007

Hi

I just downloaded CslaContrib, as I'm looking for some CodeSmith templates to produce Stored Procedures, and I find they have compile errors when started from CodeSmith Explorer 2.6. The BO's seem to be ok though.

Copyright (c) Marimer LLC