Yes, forgot to mention... In this case the key instance is the very same 
instance, just modify its data so no changes that affects Equals or GetHashcode.

I just pushed my proposal of fix to the old pull request
https://github.com/nhibernate/nhibernate-core/pull/229

If you don't agree I can fix Envers tests (there's lot of old ported Java tests 
currently failing) instead, but I'll be happy to get some input first.

From: [email protected] 
[mailto:[email protected]] On Behalf Of Oskar Berggren
Sent: den 20 november 2013 13:39
To: [email protected]
Subject: Re: [nhibernate-development] NH-3555

Changing something that affects Equals()/GetHashCode() of an object while that 
object is the key of a dictionary isn't allowed by the IDictionary contract. 
What behavior should we expect?
/Oskar

2013/11/20 Roger Kratz 
<[email protected]<mailto:[email protected]>>
Hi

I reported regression bug 3555 some time ago. This issue currently prevents 
releasing an Envers version targeting NH 4.

I'm sitting trying to fixing the issue myself, but run into an issue whether 
old behavior is correct or not.

What the issue is all about is...

var key = new KeyEntity();
var value = new ValueEntity();
var entity = new MapEntity();
entity.SomeMapProp[key] = value; (1)

[open session]
   [begin tran]
      [save entity]
   [commit tran]
   [begin tran]
       Key.SomeProperty = newvalue; (2)
   [commit tran]
[/close session]

....in other words; changing the key object of an entry in a map/dictionary.

In current NH 4 code base, code above throws. I've fixed the problem locally 
but noticed that my "fix" got another result than NH 3. In NH 3 code above 
resulted in _two_ entries in the map - both (1) and (2), while my local fix 
resulted in one entry (only 2). I personally think the behavior in NH 3 was 
wrong.

I'll be glad to fix this issue so a new Envers version could be released 
together with NH 4 alpha 2 but I need to double check with you first what the 
"correct" behavior is in this case. Any opinions?

All the best,
Roger



--

---
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:nhibernate-development%[email protected]>.
For more options, visit https://groups.google.com/groups/opt_out.

--

---
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/groups/opt_out.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to