I'm trying to use NHibernate to persist my clases to the database. In
order to do that, all "set"s must be mapped through a Iesi
collection, so all of my collections are declared as
Iesi.Collections.ISet. i.e.:
Code:
[Serializable]
public class Country
{
// Property accessors
virtual public System.Int32 Id
{
get { return this.id;}
set { this.id = value;}
{
virtual public System.String Name
{
get { return this.name;}
set { this.nombre = value;}
}
virtual public Iesi.Collections.ISet States
{
get { return this.states;}
set { this.states = value;}
}
// Fields
private System.Int32 id;
private System.String name;
private Iesi.Collections.ISet states = new
Iesi.Collections.HashedSet();
// Constructors
/// <summary>default constructor </summary>
public Pais()
{}
/// <summary>full constructor </summary>
public Pais(ref System.Int32 id, System.String name,
Iesi.Collections.ISet states)
{
this.id = id;
this.name = name;
this.states = states;
}
}
As it's going to be a web site that uses this clases, I wanted to
serve them as web services, using an SOA architecture. I tested the
NHibernate mapping files and everything with a windows form, and it
worked fine, so I created the web service that would serve my website
(and any website that might want to use it) and added a getCountry
web method. To my surprise, when I tryed to test it, I found out that
, despite the project compiled perfectly, I got an error message
saying: "You must implement a default accessor on Iesi.Collections.ISet because it inherits from ICollection.". I did some research, and found out that the interface Iesi.Collections.ISet cannot be serialized, and that's what causes the error... Unfortunately, I also noticed that everybody allways used some workaround to solve this problem, but it's allways a patch and never a solution... so, my question is, did I make a mistake choosing NHibernate? Applications are more and more using web services to interact with other applications, so is the NHibernate team (or the Iesi team) going to solve this problem? Is there an easy solution to be able to use web services that doesn't include "cheating" nor hours of refactoring?
Alex.