How to generate conditional attributes on Entity fields and navigators

Posts   
 
    
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 22-Oct-2016 15:57:55   

LLBLGen Pro 5.0.5 26 July 2016 LLBLGen Pro framework .NET 4.5.2 C# SD.Presets.Adapter.General SQL Server

I need help getting started on customizing templates. I need to do the following:

1) Add my own attribute to entity fields that represent FKs to other entities (i.e. IsFKIdAttribute)

2) Add my own attribute to entity fields that are navigators to other entities based on whether the parent entity has Cascade on Delete set or not (i.e. IsCascadeDeleteAttribute)

I've been looking through template and lpt files to try to figure this out and cannot seem to find which templates/lpt that I need to modify.

Also, I can't find the "Template Studio IDE" tool mentioned in the forum. I assume one uses the built-in editor in the designer tool now, right?

Also, I can't find any documentation on the API of code generation classes. How is one supposed to write generator code without a reference document? For example, I went into the Element Search tool and selected "Entity" as the element type and then see that the code displayed was "return p.EntityModel.Vertices" which I then wanted to experiment with to figure out how to access the Fields of an entity but, without an API doc, I don't know what the property name for entity fields is.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 23-Oct-2016 10:21:43   

Emmanuel wrote:

LLBLGen Pro 5.0.5 26 July 2016 LLBLGen Pro framework .NET 4.5.2 C# SD.Presets.Adapter.General SQL Server

I need help getting started on customizing templates. I need to do the following:

1) Add my own attribute to entity fields that represent FKs to other entities (i.e. IsFKIdAttribute)

2) Add my own attribute to entity fields that are navigators to other entities based on whether the parent entity has Cascade on Delete set or not (i.e. IsCascadeDeleteAttribute)

I've been looking through template and lpt files to try to figure this out and cannot seem to find which templates/lpt that I need to modify.

No need for template changes simple_smile It's built into the designer: http://www.llblgen.com/Documentation/5.0/Designer/How%20To/AssignAttributesToElements.htm

You can specify rules on which elements the attributes (which can contain macros) should be applied on, at the project level. You can then at the element level even say you exclude that element from the rule (in the code generation info tab of the entity editor).

Also, I can't find the "Template Studio IDE" tool mentioned in the forum. I assume one uses the built-in editor in the designer tool now, right?

That's old indeed. Since v3, the template editor is part of the designer.

Also, I can't find any documentation on the API of code generation classes. How is one supposed to write generator code without a reference document? For example, I went into the Element Search tool and selected "Entity" as the element type and then see that the code displayed was "return p.EntityModel.Vertices" which I then wanted to experiment with to figure out how to access the Fields of an entity but, without an API doc, I don't know what the property name for entity fields is.

Please see the designer reference manual: http://www.llblgen.com/Documentation/5.0/ReferenceManuals/Designer/html/70919A6F.htm And the SDK docs: http://www.llblgen.com/Documentation/5.0/SDK/index.htm

Available here: http://www.llblgen.com/Pages/documentation.aspx

But again: no need for template changes, the attributes can be assigned in the designer with easy rules. simple_smile

Frans Bouma | Lead developer LLBLGen Pro