SetObjectAliases and RelationPredicateBucket issue

Posts   
 
    
sbense
User
Posts: 55
Joined: 24-Jul-2007
# Posted on: 23-Aug-2007 13:07:44   

If I set the object aliases for a IEntityRelation object and then add it to a IRelationPredicateBucket relations collection the aliases are cleared.

Is it by design or is there a problem?

The code shown here is to show the behaviour and is used differently in the actual application in seperate functions.


Dim bucket As IRelationPredicateBucket = New RelationPredicateBucket(filter)
Dim relation As IEntityRelation = ParentEntity.Relations.ChildEntityUsingParentId

'Relation properties, aliases
relation.SetAliases("p", "c")
relation.HintForJoins = JoinHint.None

'At the point the AliasPKSide = "p" and AliasFKSide = "c" on the relation variable

bucket.Relations.Add(relation)

'At the point the AliasPKSide = "" and AliasFKSide = "" on the relation variable

To get around this I have come up with the following


Dim aliasStart As String = relation.AliasPKSide
Dim aliasEnd As String = relation.AliasFKSide
bucket.Relations.Add(relation).SetAliases(aliasStart, aliasEnd)

I am using Version 2 of LLBLGen Pro.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 23-Aug-2007 15:03:55   

Same issue is posted here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=8969

This is solved in v.2.5

For v.2.0 your solution is workable. Similarly you could use the following overload of the RelationCollection Add method:

public virtual IEntityRelation Add( 
   IEntityRelation relationToAdd,
   string aliasRelationStartEntity,
   string aliasRelationEndEntity,
   JoinHint hint
)
sbense
User
Posts: 55
Joined: 24-Jul-2007
# Posted on: 23-Aug-2007 16:12:05   

Thank you. This is now resolved.