views:

69

answers:

2
A: 

Just answered here

Diego Mijelshon
+1  A: 

Try this:

public class Person {
    public virtual int Id { get; set; }
    public virtual string FirstName { get; set; }
    public virtual IList<PersonAddress> PersonAddress { get; set; }
    ... }

public class PersonAddress {
    public virtual int Id { get; set; }
    public virtual Person Person { get; set; }
    ... }

You should have a reference to the Person, and not just a PersonId. And if you have difficulties with the .hbm.xml mapping files, consider using Fluent NHibernate instead. Its automatic mapping feature works like a charm.

There is also a video series on NHibernate, which covers the subject pretty well.

Venemo
+1 for suggesting FNH auto mapping
Tom Bushell
Thank you very much. :)
Venemo
I know that it is possible by bidirection. But I was thinking about possibility without it. as I understand this is not possible.
Yauhen.F
I don't know if it is possible, but there is no point in doing it. Why is that Person property bothering you?
Venemo