Hello,
I am trying to create a predefined prefetch for all related entities using the following TDL code.
Public Shared ReadOnly Property PrefetchAll() As IPrefetchPath2
Get
Dim prefetch As IPrefetchPath2
prefetch = New PrefetchPath2(EntityType.<[CurrentEntityName]>Entity)
<[ Foreach RelatedEntity ManyToMany]><[If Not MappedFieldRelationIsHidden]>
prefetch.Add(<[CurrentEntityName]>Entity.PrefetchPath<[ MappedFieldNameRelation ]>)
<[EndIf]> <[ NextForeach ]>
<[ Foreach RelatedEntity ManyToOne]><[If Not MappedFieldRelationIsHidden]>
prefetch.Add(<[CurrentEntityName]>Entity.PrefetchPath<[ MappedFieldNameRelation ]>)
<[EndIf]> <[ NextForeach ]>
<[ Foreach RelatedEntity OneToMany]><[If Not MappedFieldRelationIsHidden]>
prefetch.Add(<[CurrentEntityName]>Entity.PrefetchPath<[ MappedFieldNameRelation ]>)
<[EndIf]> <[ NextForeach ]>
<[ Foreach RelatedEntity OneToOne]><[If Not MappedFieldRelationIsHidden]>
prefetch.Add(<[CurrentEntityName]>Entity.PrefetchPath<[ MappedFieldNameRelation ]>)
<[EndIf]> <[ NextForeach ]>
Return prefetch
End Get
End Property
My first question, is there an easier way than specifying all of the different RelationTypes?
next, some entities have no relatedEnties that are visible, is there a way i can suppress this property from being in my output.
I am thinking that TDL is pretty powerful since all of the included templates are generated with this, but i suspect that i may need to switch to lpt.
Any suggestions are appreciated.
Thanks,
Gabe