-
Notifications
You must be signed in to change notification settings - Fork 932
Description
Hi there,
I used nhibernate v4.1.4 for a long time and all works perfectly until we decide to update to lastest version. (5.3.10) We use it on a wcf service. Data loaded correctly but when objects are serialiazed (with wcf mechanisms) all collections are gone away... :( I precise that all collections load correctly with data inside before serialization.
I try to debug with this snippet
var myObjectWithCollections = Session.Query<MyClass>().Single(x => x.Id == id);
var serializer = new NetDataContractSerializer();
var wcfMessage = new FileStream("soapMsg.xml", FileMode.Create);
serializer.WriteObject(wcfMessage , myObjectWithCollections);
When serializer.WriteObjectis called, all collection are "flushed" :(
I decide for testing to change the type of one collection from IList to ICollection to test and....tadaaaaaa. It works. Unfortunately, I don't know why and I don't want to change all collection type to this ICollection
After serialization, normally collections are of type PersisentGenericBag which implement ICollection AND IList so it sould work ! I miss something but what ?
NOTE : all my collections are "bags" in my mappings files (hbm.xml). The loading mode was neither eager nor lazy. With 4.1.4 mappings were configured with full loading.
Have you got some ideas cauz I'm a bit confused now :(
Subject posted to stackoverflow too