I am working on an application where I am trying to perform a data import from an exported XML file into a new system using NHibernate. Currently the application is set up to take the input XML and transform it using XSLT into the serialized version of the objects for the database. In running some general serialization tests to get the schema for transforming the input XSLT, I have encountered some issues. It seems any object I have that has members with associations via NHibernate.Collection.Set won't serialize properly. Here is the error detail:
Exception: There was an error reflecting type 'GeoLearning.Core.Volume'.
Inner Exception: You must implement a default accessor on NHibernate.Collection.Set because it inherits from ICollection.
Stack Trace: at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel)
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a)
at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace)
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type)
at GeoLearning.Courseware.Meta.WS.VolumeService.GetVolumes() in c:\Projects\Courseware\Public\CoursewareMeta\App_Code\VolumeService.cs:line 319
The Volume object contains four different sets that link to other objects in the same library. I have tried to serialize this through the SoapFormatter and it seems to work fine, but the translation to write into the format that the SoapFormatter needs looks like it will be a lot more work. Is this a bug with NHibernate or do I need to be doing this a different way?
|