Partial Success with Code Generators.

Partial Success with Code Generators.

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


rxelizondo posted on Saturday, April 16, 2011

 

Hello,

I am currently using a code generator tool with mixed results.  Although the tool is doing a great job of generating most of the CSLA basic plumbing code, the code generated is not perfect and I am finding myself applying a bunch of do-hickies all over the place to bring the generated code up to speed and this is getting to be somewhat frustrating process for me.

I am at the point right now where I am thinking of letting the code generator tool dump the initial code into some staging project and then simply copy and paste that code from that project into a real project and then take it from there. In other words, my final code ends up being totally disconnected from the code generator tool so any changes to my source metadata will not be automatically reflected into my CSLA objects by the code generator tool, I will have to update these changes manually

Before I do that though, I would like to know if anyone here has experienced complete success with code generator tools for the CSLA or if most of you end up doing what I am planning on doing.

Thank you.

 

tiago replied on Sunday, April 17, 2011

Hi Rene,

Some notes:

  1. If your CodeGen tool is a payed product, I would try to speak to the maintenance people.
  2. Are there templates you can edit to fit your needs?
  3. This link Code generation is a good idea discusses the generation/re-generation  issue. As you can conclude from the link, CslaGenFork tries to avoid the issue "after re-generation I lost my changes".

Since you say code generated is not perfect I guess your problem is well before re-generation. Do you mean the generated code isn't complete (like you have to hand code the AddBusinessRules method) or it isn't correct (like PropertyInfo isn't generated for every property, or parameter passing to Factory or DataPortal methods isn't allowed or is plain wrong)?

rxelizondo replied on Monday, April 18, 2011

tiago

1. If your CodeGen tool is a payed product, I would try to speak to the maintenance people.

Been there done that, not much I can do other than apply the patches.

tiago

2. Are there templates you can edit to fit your needs?

Yeah, but that is one more task I rather not undertake at this time. It is true that the time I spend fixing the templates to fit my exact needs is time well spent since I will save a bunch of time later when I generate the code but I am not sure if I want to deal with that right now.

tiago

3. This link Code generation is a good idea discusses the generation/re-generation  issue. As you can conclude from the link, CslaGenFork tries to avoid the issue "after re-generation I lost my changes".

I have already disconnected my code from the code generator tool. A decision that I have a feeling I may come to regret later. In any event, it feels great not to have all those patches on the code and all that extra code bloat (at least is bloat for my particular needs) the generator produces. I hope to have some time in the future to look into creating my own custom templates.

-----------------------

Anyway, I guess I was mostly interested to hear what other people are experiencing with code generator tools. I guess I was seeking comfort in the tough that I was perhaps not the only one doing what I am doing.

In any event, I have high hopes for the future versions of the code generator I am using, they look very promising. I wasn't aware of your open source code generator, I will take a look into it.

Thanks.

Copyright (c) Marimer LLC