Given the database design below how would you model it? Address Type is Bussiness/Home etc and the PersonId is on Address table is because there are many addresses for one Person.
I would most do something like:
public class Person
{
public virtual int PersonId { get; set; }
public virtual string FirstName { get; set; }
public virtual string LastName{ get; set; }
public virtual DateTime DOB{ get; set; }
public virtual IList<Address> Addresses { get; set; }
}
public class Address
{
public virtual int AddressId{ get; set; }
public virtual Person Resident{ get; set; }
public virtual AddressType Location{ get; set; }
public virtual string PostalCode{ get; set; }
public virtual string FullAddress{ get; set; }
}
public class AddressType
{
public virtual int AddressTypeId{ get; set; }
public virtual string Description{ get; set; }
public virtual IList<Address> Addresses { get; set;}
}
however I have no idea if this is appropriate.
I have always done my models with objects and have never left int
's in place. NHibernate Mapping will easily replace these with the objects and then lazy/eager load them, so I just figure this is the best option. Opinions?