NHibernate Version: NHibernate 1.2 Beta2:
Full stack trace of any exception that occurs:
[InvalidCastException: Unable to cast object of type 'System.Collections.Generic.Dictionary`2[System.Int32,XYZ]' to type 'System.Collections.Generic.IList`1[XYZ]'.]
NHibernate.Collection.Generic.PersistentGenericMap`2.GetSnapshotElement(Object entry, Int32 i) +214
NHibernate.Persister.Collection.OneToManyPersister.DoUpdateRows(Object id, IPersistentCollection collection, ISessionImplementor session) +4875
Description:
It looks like the GetSnapshotElement method is trying to cast to an IList when it should cast to an IDictionary. I looked at the PersistentMap class and noticed that it converts to an IDictionary and not an IList. Perhaps the code should look more like this:
Code:
IDictionary<TKey, TValue> sn = ( IDictionary<TKey, TValue> ) GetSnapshot();
return sn[ ((KeyValuePair<TKey, TValue>)entry).Key ];
instead of the current:
Code:
IList<TValue> sn = ( IList<TValue> ) GetSnapshot();
return sn[ i ];
[/b]