Re: Using Relationships - Best way to represent them

Re: Using Relationships - Best way to represent them

Old forum URL: forums.lhotka.net/forums/t/119.aspx


RockfordLhotka posted on Tuesday, May 16, 2006

I prefer option #2, because I usually just want to provide navigational convenience, and I don't want to be responsible for the lifetime of this other object.

Option #1 is good, however, if I'm using this other object within the containing object - in which case maintaining a reference is a fine thing. But then you need to realize that you've assumed control for that object's lifetime to some degree - in that the object instance will stay around as long as your containing object stays around.

If you do #1, make sure to make it as [NonSerialized] as well, because you probably don't want this (presumably root) object moving around the network with your object - that could get a bit messy (unless you plan for it).

Copyright (c) Marimer LLC