How to map subclass and subclass properties in NHibernate and C#

WROLMERSEHERA

New Member
How to map this type of subclass container situation in Nhibernate. Help me providing the mapping xml structureMy Class Strucutre\[code\]public class Employee{ public virtual int EmpID; public virtual string EmpName; public virtual Audit AuditDetails;}public class Audit{ public virtual User CreatedBy; public virtual DateTime CreatedOn; public virtual User ModifiedBy; public virtual DateTime ModifiedOn;}public class User{ public virtual int UserID; public virtual string FullName; public virtual Audit AuditDetails;}\[/code\]My database table structure \[code\]EmployeeEmpID(int pk) | EmpName(varchar) | CreatedBy(int) | ModifiedBy(int) | CreatedOn(date) | ModifiedOn(date)UserUserID (int pk) | FullName(varchar) | CreatedBy(int) | ModifiedBy(int) | CreatedOn(date) | ModifiedOn(date)\[/code\]Using NHibernate and C# I wish to solve this situation.
Most of my tables contain the Audit detials (creator, Modifier and datetimes of them)
I wish to map in such a way that the Userid should be saved as the CreatedBy and ModifiedBy fields and for Dates is a direct mapping.
But those all details is a seperate entity called Audit in my class structure.
Please help me by providing a mapping sheet for this type of situation.
Any help is appreciated.
 
Back
Top