NHibernate.Collection.PersistentCollection is no longer a valid collection type?  
Author Message
Greg Banister





PostPosted: Windows Communication Foundation ("Indigo"), NHibernate.Collection.PersistentCollection is no longer a valid collection type? Top

I'm using nHibernate on a project that I started with the Feb CTP.  I have DataContracts that contain ILists that are of type NHibernate.Collection.Bag, like so

    [DataContract]
    [KnownType(typeof(NHibernate.Collection.Bag))]
    [KnownType(typeof(NHibernate.Impl.CollectionEntry))]
    [KnownType(typeof(Person))]
    public class Company : IEntity
    {
 ...

        [DataMember]
        private IList employeesList;

 ...
    }

This worked just fine with the Feb CTP but now with the May CTP when WCF attempts to generate the WSDL the following exception is thrown:

An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: http://www.hide-link.com/ :ICompanyService
Type 'NHibernate.Collection.PersistentCollection' is an invalid collection type since it does not have a valid Add method with parameter of type 'System.Object'


NHibernate.Collection.Bag does implement IList and has an Add(System.Object item) method.  NHibernate.Collection.Bag also derives from NHibernate.Collection.PersistentCollection which does not implement IList.  But since I'm using Bag, I don't understand why I get the above error messages in the trace file.

Is there a way to handle this that would allow me to send the nHib collection over the wire as I could with the Feb CTP, or am I screwed

Thanks,
Greg
 




Visual Studio 20087  
 
 
Greg Banister





PostPosted: Windows Communication Foundation ("Indigo"), NHibernate.Collection.PersistentCollection is no longer a valid collection type? Top

I've posted a (possible) solution to the above issue here:

http://forum.hibernate.org/viewtopic.php t=961196&sid=0260a7bc48df2dbfb5fb42b4a348a149