About collection isolation I myself just accept it as a sacrifice for Nbernate (just like argument-less ctor's and "virtual`ity") and use exposed IList everywhere (with private setters) just to reduce technical complexity. Their contents surely can be modified from outside, but I just don't do that It's more important to keep code easily understandable than making it super safe. Safety will follow.
If I recall correctly - Nbernate filter works as additional clause in sql queries to reduce returned rows from db. My question to You is - why do You need that? I mean - how much addresses one person might have?1?5?10?
About collection isolation... I myself just accept it as a sacrifice for Nbernate (just like argument-less ctor's and "virtual`ity") and use exposed IList everywhere (with private setters) just to reduce technical complexity. Their contents surely can be modified from outside, but I just don't do that. It's more important to keep code easily understandable than making it super safe.
Safety will follow.
My understanding is that it's best practice to create a helper method to do that so you can handle the bi-directional relationship. – Mike C. Mar 13 at 0:16 @Mike I don't handle that.
That's what I meant with sacrifice. I'm just making up convention not to do that. Might not work if You don't have control over consumers (easy for me - I even don't have a team in my project, I'm alone).
What did You mean with helper methods handling bi-directional relationships? – Arnis L. Mar 13 at 0:22 @Mike how would You handle messing around with reflection and modifying private collection?
:) – Arnis L. Mar 13 at 0:24 LOL, good point. I'd probably put some sort of alert so I could smack somebody upside the head if they did it.
– Mike C. Mar 13 at 19:56.
I am trying to map a domain model in NHibernate. The domain model is implemented with what I think is DDD style. The mapping works mostly but then when I try to use a collection filter on an a collection I get an exception which says: The collection was unreferenced.
I know the problem comes from how I've implemented the collection. My question: Is it possible to use collection filters in nHibernate on collections implemented this way or should I just forget it, i.e. NHibernate cannot work with this.
The main issue is that I don't want to expose the internal addresses collection publicly. Every other thing works, I use the field. Camelcase-underscore access so nHibernate interacts directly with the field.
I've been working through the Hibernate in Action book, an now I'm in chapter 7 where it deals with collection filters. Is there any way around this. But I really don't want to do this.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.