Tutorial on creating templates/tasks etc

Posts   
 
    
Posts: 98
Joined: 09-Feb-2005
# Posted on: 26-May-2006 22:27:21   

My setup: Adapter, .net 2.0, using Validators

I'm trying to create partial classes that extend the entity classes to use the validators that I've figured out how to activate. Code-wise, I'm basically following the example in the chm.

It's clear that the template system was designed to be the ultimate in flexibility and power, but I'm finding myself completely bewildered by all of the various templates, directories, and parameters.

By any chance, could someone post a best practices / tutorial for how to get started?

Thanks all.

Posts: 98
Joined: 09-Feb-2005
# Posted on: 27-May-2006 05:30:18   

Ok, so maybe I wasn't going about things the best way... I'll include how I solved it for others. I'd still really like to see a tutorial though, as I'd really like to be able to start using CoolJ for my codesmithing duties. :-)

I created a folder for my own templates, and added 2 files. 1 was the template, and the other the templatebinding. The binding (whose ID must be Custom_EntityAdapterTemplate) will be sucked in automatically by CoolJ


<?xml version="1.0"?>
<templateBindings xmlns="http://sd/llblgen/pro/templateBindingsDefinition.xsd" name="VC.Validation.NET20"
                  description ="Template bindings for creating partial classes that use the generated validators"
                  precedenceLevel="10">
    <supportedPlatforms>
        <platform name=".NET 2.0"/>
    </supportedPlatforms>

    <language name="C#">
        <!-- Generic template bindings -->
        <templateBinding templateID="Custom_EntityAdapterTemplate" filename="VC.EntityValidator.template"/>
    </language>
</templateBindings>

The template content is


        /// <summary>
        /// Creates the validator object for this entity. Routine is called from the entity constructor. Implement in an entity
        /// class to set a particular entity validator object at construction time.
        /// </summary>
        /// <returns></returns>
        protected override IValidator CreateValidator()
        {
            return new <[RootNamespace]>.ValidatorClasses.<[CurrentEntityName]>Validator();
        }

Posts: 94
Joined: 26-Feb-2006
# Posted on: 27-May-2006 13:37:27   

I really like the term "CoolJ" maybe we could convince Frans the change the name for v3! smile besides I donĀ“t think that the gangsta rapper will have something against it!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 29-May-2006 10:37:12   

Thanks for the template, Jeff simple_smile .

There will be tutorials for v2, much more than we currently have. We've planned to convert the how do I section into tutorials and also more tutorials how to write additional templates, as it's now much more easier than in the current version.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 98
Joined: 09-Feb-2005
# Posted on: 30-May-2006 05:52:22   

Sounds as if you're doin' it, doin' it, and doin' it well. :-) Thanks for the heads up.