Same table NHibernate mapping

Posted by mircea . on Stack Overflow See other posts from Stack Overflow or by mircea .
Published on 2012-04-02T10:01:34Z Indexed on 2012/04/02 11:30 UTC
Read the original article Hit count: 281

How can i go about defining a same table relation mapping (mappingbycode) using Nhibernate

for instance let's say I have a class:

public class Structure{
 public int structureId;
 public string structureName;
 public Structure rootStructure;
}

that references the same class as rootStructure.

 mapper.Class<Structure>(m =>
            {
                m.Lazy(true);
                m.Id(u => u.structureId, map => { map.Generator(Generators.Identity); });
                m.Property(c => c.structureName);
                m.? // Same table mapping 
}
 ;

Thanks

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about nhibernate-mapping