Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:09:31+00:00 2026-06-03T06:09:31+00:00

How to map this type of subclass container situation in Nhibernate. Help me providing

  • 0

How to map this type of subclass container situation in Nhibernate. Help me providing the mapping xml structure

My Class Strucutre

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;
}

My database table structure

Employee
EmpID(int pk) | EmpName(varchar) | CreatedBy(int) | ModifiedBy(int) | CreatedOn(date) | ModifiedOn(date)

User
UserID (int pk) | FullName(varchar) | CreatedBy(int) | ModifiedBy(int) | CreatedOn(date) | ModifiedOn(date)

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:09:32+00:00Added an answer on June 3, 2026 at 6:09 am

    If you want to put your Audit entity in the same tables, you will need to use <component>. Here’s a tutorial:

    http://ayende.com/blog/3937/nhibernate-mapping-component

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a recursive data type like this: template<typename T> struct SomeType { std::map<T,
I have this as a return type in Scala Map[String, Seq[Map[String, Seq[MyClass]]]] I have
I have a Map that uses a Set for the key type, like this:
I have an abstract class and subclasses of this, and I want to map
How would you go about implementing a map of this type in Silverlight? The
I have a map that has data of this type: {4e237b32eca4a6103061abf7:27.94904038727,-82.6213887207031,test again,} I am
I have this custom type: public struct PasswordString { private string value; public PasswordString(string
I have 3 simple classes: public abstract class Container implements WritableComparable<Container> {} //empty public
I have a java class that contains a hash map as a member. This
public static MapFrom Map(this IDataReader idr, params string[] columns) { return new MapFrom {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.