how to remove code preservation logic

Posts   
 
    
vairam2008
User
Posts: 86
Joined: 11-Mar-2008
# Posted on: 03-Apr-2008 00:10:19   

Is there a setting in Project properties or this another template change to remove code preservation logic

#region Code preservation logic for upgrading from 1.0.200x.y to v2.
        /// <summary> Method which is used to preserve code written in validator classes when LLBLGen Pro v1.0.200x.y was used. Please consult the Migrating Your Code section in the manual
        /// for details about this method and the contents of it.</summary>
        /// <param name="fieldIndex">Index of the field</param>
        /// <param name="value">new value of the field.</param>
        /// <returns>true, if value is a valid value for the field with index fieldIndex, false otherwise.</returns>
        /// <remarks>For code preservation only. If empty, ignore this method.</remarks>
        protected virtual bool OriginalValidate(int fieldIndex, object value)
        {

I am having so much of code base generated that we will not use since we are not migrating, is there a way not to generate it?

thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Apr-2008 06:59:42   

Hi Vairam,

You can - specify what tasks you want LLBLGen generates. For example, if you don't use the Validator classes you can disable/remove it. You can save your set of tasks to execute in a custom Preset File. - specify the TemplateId precedence to choose what templates are used among various template bindings.

For more info read LLBLGenPro Help - Using the designer - Generating code - Configuring the generation process

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 03-Apr-2008 09:38:45   

The validator templates are actually empty, besides the class definition. So it's best if you write your own validator classes when you need them. Say you have 400 entities, and you need validation on 20 entities, then you write those 20 validators. As the vast majority of the code inside a validator is hand-written custom code, generating them isn't really useful. Though if you want to generate them with code you create inside a template, you can use David's tips in his post above simple_smile

Frans Bouma | Lead developer LLBLGen Pro
vairam2008
User
Posts: 86
Joined: 11-Mar-2008
# Posted on: 03-Apr-2008 10:20:35   

what I was wanting to add in my code generation was to include some standard methods & as well some specific methods & properties (expressions) not defined in a table as custom values.

I am trying to explore & maximize the possibility of using Gen Pro as a modelling tool for my business objects. Even though the modelling tool seems to be feature rich, the limitations I am seeing with the generator is that the templates & plugins are source controllable (externally), I am finding intellisense limitations in the templating studio. Is it possible to use Visual Studio for that purpose & maximize the functionality?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 03-Apr-2008 16:45:19   

Templatestudio isn't vs.net, and it will never be vs.net, because building intellisense for C# etc. is very hard.

Writing templates should be done this way: - write the code you want to generate for one entity by hand. This can be done in vs.net - pick that code and covert it into a template by 'templating' the parts which are specific for that entity and which are repetitive, i.e. should be generated with a loop, like all relations - run the template to see if it works out well

You'll see that step 2 is actually pretty small. The problem with writing template code inside the template editor is that if you don't know what the output should be, writing the template is actually pretty hard, and time consuming: you have to regenerate the code a lot of times which is not that productive.

Frans Bouma | Lead developer LLBLGen Pro