Hi guys,
I'm brand new to the forum, since I started using NHibernate yesterday, dropping out the ORM I used to develop for a while (which wasn't bad, but had not the community support (N)Hibernate has).
My question is about the procedure for writing an HBM mapping that makes me select multiple types in the same IList instance of a type, using some polymorphisms.
Something like:
Code:
public class Person {
public long Id;
public string FirstName;
public string LastName;
public IList Addresses;
}
public class Address {
public long PersonId;
public string Street;
public string Number;
public string City;
public string State;
public string Country;
public string Zip;
}
public class WorkAddress : Address {
public string OfficeNumber;
}
The result I would like to obtain is to select from the tables "Address" and "WorkAddress", all the instances related to the "PersonId" field specified.
My assumption was to use several <idbag> (one for each entity type to select) on the same field ("Addresses" in this case).
Could you please correct me if I'm wrong and eventually post me a valid HBM to achieve this result?
Thank you all!
Antonello