These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Shared collections on self-referencing tree
PostPosted: Thu Jun 04, 2009 12:27 am 
Newbie

Joined: Thu May 14, 2009 11:48 pm
Posts: 6
hi all.

I have a tree structure of Folders (parent child) and each folder can
be tagged with a tag (Tags collection of Folder).
That's all fine ..

Now I would like that all children folders have the same tags as the
parent ... Basically I just need to point the Tags collection to the
one of the parents tags

Code:
public virtual IList<Tag> Tags {
            get {
                if (IsChild) {
                    return Parent.Tags;
                } else {
                    return _tags;
                }
            }
            set {
                if (IsChild) {
                    _tags = Parent.Tags;
                } else {
                    _tags = value;
                }
            }
        }


The problem is that this does not work and i am getting:

Found shared references to a collection:
ITAssessments.Core.Domain.Folder.Tags

That is correct but I would like to know how to model that correctly
so that child folder can share the same tags as the parent. Thanks for
digging into !


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.