fly2moon2 wrote:
Hi All,
With you all guys' help and explanations, I'm "almost" done to my basic needs on setting one-to-many relationships.
My Class ....
public class LegalPerson
{
private Address[] _addresses;
public virtual Address[] addresses
{
get { return _addresses; }
set { _addresses = value; }
}
}
NHibernate requires the property to be from "correct" type in case of association, depending on the mapping, ILIst, ICollection, Iesi.Collection.ISet, IDictionary, ... (maybe I missed something)
Anyway, it is not adviseable to to use array proeprties like You do. In followng code
Address[] addrs = person.addresses;
addr[0] = new Address();
the content of person.addresses is changed.
You might want to run fxcop on Your assembly and see what it thinks about different constructs.
Gert