c# - How to deserialize Enumerable.ToList<>() to List<> -


I'm trying to create an object that looks like this:

  Public class MyObject {Private IList & lt; Other Object & gt; item; Public listing & lt; Other Object & gt; Item {return item. ANI numeric (). ToList & lt; Other Object & gt; (); }}  

I am using NHibernate as my DAL and map it directly to the items field and all works well.

I am also using the Windows workflow and the replication activity does not work with the normal ILID () it basically allows me to use the list & lt;> wrapper instead of ILIST & lt;> Forcing it to break the direct NHibernate mapping because the IList implementation of NHibernate can not be directly put in the list. ** Edit: Windows workflow requirement really means that I want to lose type-safe access, it does not matter in the list why it needs the ILIT.

Now the goal is to serialize / disassemble this object. It works fine with binary serialization but the implicit NHibernate proxy objects blast with nhibernate errors when I try to deserialize them.

Then I tried XML serialization, the serialization works fine and gives me the definition of my good concrete class in a serialized XML file which is completely out of the Nihient Proxy. However, when trying to deserialize it, I am unable to add items to the list as items. The ANI number ..ToList will not let the call item be added to the underlying list. Add method.

Do anyone have any ideas on this? Am I going to go wrong about this?

** Edit: The NHibernate concrete class is NHibernate.Collection.Generic.PersistentGenericBag which actually implies directly to ILIL However, I have lost all the types of regular benefits in the generic list. Puts it in the scope of writing a cover for the object and I really want to avoid it if possible, if possible.

Comments