desfen wrote:
I'm curious as to why I should omit the setter ? I would like to allow "users" to replace the collection with a new one, transient or not. From reading around I had gathered this was possible as long as the new collection conforms to the right interface (i.e. Ilist, IDictionary or ISet).
This is more of a .NET design guideline, than an NHibernate practice. You wouldn't want that someone who uses your class library could set the underlying field to anything. It could leave the object in an invalid state, for instance:
Parent.Children = null;
// ...
later
Parent.Children.Add("Jimmy");
will throw a null reference exception.
I think this is just a matter of personal preference, but if you read about .NET design guidelines or have seen Brad Abrams speak about it (available as webcast too), he might give you some good points on things like this.