Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Custom Templates> Get SubTypes
 

Pages: 1
Custom Templates
Get SubTypes
Page:1/1 

  Print all messages in this thread  
Poster Message
mshe
User



Location:
Markham, Canada
Joined on:
02-Feb-2006 23:31:34
Posted:
167 posts
# Posted on: 17-Jun-2008 21:45:08.  
Hi all,

Is there a ForEach statement to retrieve a list of subtypes from a supertype?

I like to iterate over a supertype's subtype so that I can generate the appropriate ServiceKnownType attribute declarations.

i.e.

<ServiceKnownType(MySubType1)> _
<ServiceKnownType(MySubType2)> _
<ServiceKnownType(MySubType3)> _
Public Class MyGeneratedSuperType

End Class


Thanks!
  Top
mshe
User



Location:
Markham, Canada
Joined on:
02-Feb-2006 23:31:34
Posted:
167 posts
# Posted on: 17-Jun-2008 22:03:16.  
The code below is sort of what I'm looking for:

Code:

<[If IsSuperType]>
    <[Foreach Entity]><[ If IsInHierarchyType TargetPerEntityHierarchy ]><[If IsSubType]><ServiceKnownType(GetType(<[CurrentEntityName]>))> _<[EndIf]><[EndIf]><[NextForeach]>
    <[EndIf]>


However, since I'm calling Foreach Entity, it's modifying the current entity context and causing the rest of my template to screw up. Any suggestions?


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37634 posts
# Posted on: 18-Jun-2008 11:55:39.  
I think the best thing you can do is to write an .lpt template instead of using TDL for this. TDL doesn't have a statement for this, so it's not useful for this type of thing, while in .lpt you can access anything you want.

To obtain all subtypes of a given entity, use in an .lpt template, the method GetSubTypes() on an EntityDefinition instance.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
mshe
User



Location:
Markham, Canada
Joined on:
02-Feb-2006 23:31:34
Posted:
167 posts
# Posted on: 18-Jun-2008 17:08:55.  
Otis wrote:
I think the best thing you can do is to write an .lpt template instead of using TDL for this. TDL doesn't have a statement for this, so it's not useful for this type of thing, while in .lpt you can access anything you want.

To obtain all subtypes of a given entity, use in an .lpt template, the method GetSubTypes() on an EntityDefinition instance.


Thank you Otis for the information Regular Smiley


  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.