I've now implemented it the way I proposed it. For the enabled filters I've just created a List<string> holding the filter names.
Pull request: https://github.com/nhibernate/nhibernate-core/pull/56 On Jan 12, 3:57 pm, cremor <[email protected]> wrote: > Today I decided to fixhttps://nhibernate.jira.com/browse/NH-2880(or > at least try to). This is what I found: > > Deserialized proxies don't have a session attached because the code in > StatefulPersistenceContext.OnDeserialization() doesn't work as > expected. StatefulPersistenceContext uses many Dictionaries (or > classes that contain Dictionaries or Hashtables) and accesses them in > OnDeserialization(). The problem is that the Dictionaries and > Hashtables are not ready to use at this point of the deserialization > (their OnDeserialization() method is called after the one of > StatefulPersistenceContext). This problem is described at many places, > here are some of > them:http://connect.microsoft.com/VisualStudio/feedback/details/94265/gene...http://stackoverflow.com/questions/457134/strange-behaviour-of-net-bi...http://stackoverflow.com/questions/279524/hashtable-ondeserialization > > The workaround (calling OnDeserialization() for all Dictionaries > manually) works fine for the members which are of type Dictionary > directly, but how should I fix the members of type IdentityMap and > HashedSet (although the HashedSet member isn't used in > OnDeserialization(), so fixing that isn't needed)? > I could also implement OnDeserialization() in IdentityMap (and > SequencedHashMap, because that is a child of IdentityMap). These > method then would forward the call to the internal Hashtables. Would > that be ok? > > And there is another point were the same problem occurs: > Deserialization of enabled filters in the Session. Do you have any > idea how I could fix that? Because even if I call OnDeserialization() > on the enabledFilters Dictionary, the filter.Name property still > throws an exception in the loop. In Hibernate this is implemented by > iterating through the names instead of the filter objects itself, but > I couldn't find such a filter name list in NHibernate. > > My current changes are in this > branch:https://github.com/cremor/nhibernate-core/commits/NH-2880
