deepakkb wrote:
How do I check if a particular relation exists in a relationCollection.
I want to add a new relation to the relationcollection only if it does not exist.
Any ideas or work arounds will be great.
You can traverse the collection and check each EntityRelation object in the collection, to see if the start/end fields are of the entity type you expect (check ContainingObjectName on a field), and if TypeOfRelation is what you're looking for. If a duplicate relation is added to a relation collection, that's not a problem: both sides are then already in the join list, so the relationcollection will simply skip the relation.