How to get TargetName value in LPT

Posts   
 
    
jovball
User
Posts: 435
Joined: 23-Jan-2005
# Posted on: 03-Apr-2013 16:40:51   

I'm looking for the same kind of data that I would get from <[ElementTargetSchemaName]>.<[ElementTargetObjectName]> in a template file such as "dbo.Customers."

Walaa avatar
Walaa
Support Team
Posts: 14954
Joined: 21-Aug-2005
# Posted on: 03-Apr-2013 19:15:21   

Do you need these in a template file, tdl or in code?

jovball
User
Posts: 435
Joined: 23-Jan-2005
# Posted on: 03-Apr-2013 21:12:51   

I'll be using it in an LPT file so I guess the answer is code.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Apr-2013 08:14:50   

You should check the .lpt section on the SDK docs. Also check the TemplateBindings at LLBLGenPro Designer and look for the DDL Scripts templates which uses that kind of code a lot, specially the CreateScript.lpt and FieldCreationInclude.lpt files.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39625
Joined: 17-Aug-2003
# Posted on: 04-Apr-2013 09:25:22   

If you want the exact same output, you could look up in the TDL interpreter sourcecode (in the extras section at the website) the name statement or single token statement handlers, and check what's done there.

Frans Bouma | Lead developer LLBLGen Pro
jovball
User
Posts: 435
Joined: 23-Jan-2005
# Posted on: 04-Apr-2013 13:58:43   

I've already done a lot of work with lpt files in the past. However, I can't figure out how to navigate the object model from EntityDefinition to what I want.

Frans, I don't see that source code in the extras section. Perhaps it was moved somewhere else in the new website design?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39625
Joined: 17-Aug-2003
# Posted on: 04-Apr-2013 14:18:25   

It's the LLBLGen Pro v3.5 Sourcecode package, all sourcecode is in there, also the TDL interpreter. Hope it helps to find what you're looking for simple_smile

Frans Bouma | Lead developer LLBLGen Pro
jovball
User
Posts: 435
Joined: 23-Jan-2005
# Posted on: 04-Apr-2013 23:33:14   

I've looked through the source code before but I don't think I saw the CodeGenerator solution. That's a gold mine for the future.

The answer to my question is below. This LPT file is acting upon each entity in the project.

// get the mapping for this entity
EntityMapping mapping = currentProject.GetGroupableModelElementMapping(currentEntity, _executingGenerator.DriverID) as EntityMapping;

Use the mapping in the comments for a generated class

///<summary>
///Methods for fetching, saving and deleting <%= entityClassName %>.
///Database target is <%= mapping.MappedTarget.FullName %>
///</summary>

Sample result in the generated file:

///<summary>
/// Methods for fetching, saving and deleting CustomerEntity.
///Database target is dbo.Customers
///</summary>
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 05-Apr-2013 07:07:09   

Yep. Thanks for sharing. Another way I like to practice to navigate through the model is to use the "Search element" feature in the LLBLGenPro Designer, and use the LLBLGenPro_CoreAssemblies.ReferenceManual.chm help file to understand the class model.

David Elizondo | LLBLGen Support Team