How to add custom parameters to templates?

Posts   
 
    
horo
User
Posts: 41
Joined: 01-Sep-2005
# Posted on: 30-Jun-2006 11:28:33   

Hi to All,

Sorry for this Q, surely I missed something but I really could not find how to add my own custom parameters (macros) to templates in project (or entity level)

For example I would like to define a project custom property named Test with Value=Hello, and use it my custom template as llblgen uses it's own macros: <[Test]>. (This is not working for me, the generated text contains literally the macro reference itself: "<[Test]>"

How to accomplish this task in project level and maybe entity level?

thx for answers

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 01-Jul-2006 08:32:53   

Have you checked out the "Adding your own code to the generated classes" section in the manual? It contains a small tutorial how to add your own property to the entity classes using an include template.

Frans Bouma | Lead developer LLBLGen Pro
horo
User
Posts: 41
Joined: 01-Sep-2005
# Posted on: 03-Jul-2006 11:47:16   

Hi,

Thx for answer,

I've already read the chapter you recommended, maybe I still miss something... (I do know how to access custom properties in generated code programmaticaly, but this is not the case)

What I would like to do is create a custom property in project level (similar to not custom properties like <[RooNameSpace]>), and use it in templates in similar way.

For example I would like to define a project custom property named Test with Value=Hello, in llblgen designer property window and refer to it in my custom template text as llblgen uses it's own macros: <[Test]>.

This gives me the result literally the macro reference itself: "<[Test]>" and not Hello.

Is it possible?

thx for answers.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 04-Jul-2006 12:41:51   

horo wrote:

Hi,

Thx for answer,

I've already read the chapter you recommended, maybe I still miss something... (I do know how to access custom properties in generated code programmaticaly, but this is not the case)

What I would like to do is create a custom property in project level (similar to not custom properties like <[RooNameSpace]>), and use it in templates in similar way.

For example I would like to define a project custom property named Test with Value=Hello, in llblgen designer property window and refer to it in my custom template text as llblgen uses it's own macros: <[Test]>.

This gives me the result literally the macro reference itself: "<[Test]>" and not Hello. Is it possible?

The <[ ]> statements are tokens of TDL which is parsed and interpreted by the TDL parser/interpreter combination. So you can't create new statements in your own templates. That said, if you want to have the value of the custom property 'Test' generated into your code, use: <[ Foreach CustomProperty Project]> <[If StringValueEquals CustomPropertyName "Test"]><[CustomPropertyValue]><[EndIf]> <[NextForeach]>

Not ideal, so if possible in this, use an .lpt include template which gives you more flexibility

Frans Bouma | Lead developer LLBLGen Pro
horo
User
Posts: 41
Joined: 01-Sep-2005
# Posted on: 04-Jul-2006 16:23:39   

Hi,

Thx for answer.