Code Generation and Templates in CSLA

Code Generation and Templates in CSLA

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


FCazabon posted on Tuesday, April 10, 2007

Hi,

I've just finished going through chapters 6 to 8 in the Expert VB book.  I want to get an idea of how fast I can build an application like the Project Tracker application, from scratch.

I saw mention of "Code Generation" and "Templates", is there a code generation tool and templates for speeding up the application development?

Am I even asking the right question? :)

Thanks,

Frank

Plowking replied on Wednesday, April 11, 2007

Hi, yes there are code generation templates as part of the CSLAContrib project.

As far as I am aware they can be used with various code generators to generate CSLA classes (such as codesmith, or codebreeze).

I have played with them a little to generate classes from database tables, but that just seems wrong. I end up with datacentric objects.

Can anyone summarise whats required to generate vb.net CSLA classes from UML Class diagrams? The (now aged) opensource version of codesmith doesnt seem to allow this.

Regards,

Ian


FCazabon replied on Wednesday, April 11, 2007

Hi Ian,

I've looked at the Contrib project, but I'm not finding anything on templates.  Can you give me some directions on how to find this on codeplex, please?

Thanks a lot,

Frank

FCazabon replied on Wednesday, April 11, 2007

Thanks Ian,

Can you tell me how to find these templates, please?  I've looked at the site but can't find my way around, I seem to go in circles and haven't been able to find any templates to download.

Thanks again,

Frank

FCazabon replied on Wednesday, April 11, 2007

Sorry about the double posting before.  I got an error after hitting [Post] the first time, so typed in a new reply and that worked.  Obviously the first one had worked too.

Anyhow, I found the Templates, I needed to go to the Releases and download the Codesmith VB templates.

Thanks for your help.

xal replied on Wednesday, April 11, 2007

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

Andrés

FCazabon replied on Wednesday, April 11, 2007

Thanks Andres, checking it out now!

Frank

FCazabon replied on Wednesday, April 11, 2007

Hi Andres,

I've spent a little time looking at this tool but I'm getting some problems trying to understand what I should do.

I've found http://www.cslagenwiki.com/~cslagenw/mediawiki001/index.php?title=Main_Page which has helped me get started, but now I'm stuck.

I've created a new project and just tried to generate what is there in the default.  I get this error:

======================================================================
CslaObject:
Failed:
    GetObject.inc: Missing GetObjectCriteriaType
    DeleteObject.inc: DeleteObjectCriteriaType is missing
    DataPortalFetch.inc: Missing GetObjectCriteriaType
    DataPortal_Delete.inc: DeleteObjectCriteriaType is missing

If I add a criteria Object, then that reduces the mesage to this:

======================================================================
CslaObject:
Failed:
    DeleteObject.inc: DeleteObjectCriteriaType is missing
    DataPortal_Delete.inc: DeleteObjectCriteriaType is missing

But I can't see what to do to get rid of that error.

Is the google group the best place to ask for help on this?  Or is here good enough?

Thanks,

Frank

FCazabon replied on Wednesday, April 11, 2007

Andres answered this post at the CSLAGenerator Google Group.

The problem is that the CSLAObject is a dummy object that should be deleted.  You also need to ensure that the table you are creating the Object off of has a primary key.

Copyright (c) Marimer LLC