In the project I'm working on, I have the following people: analyst, client and contractor. Each inherits from a base class user.
public abstract class User {
public virtual int Id { get; set; }
public virtual string Username { get; set; }
public virtual string FullName { get; set; }
}
Then I have other classes inheriting from the base class:
public class Analyst : User {
}
public class Client : User {
}
public class Contractor : User {
public int TotalJobs { get; set; }
public int JobsInProgress { get; set; }
}
For the above classes, I have the following table structure:
USER
UserId
Username
FullName
UserType (1 = Analyst, 2 = Client, 3 = Contractor)
CONTRACTOR
UserId
TotalJobs
JobsInProgress
There are no tables for the Analyst and Client classes.
I would like to know how I can write an NHibernate mapping file for the Contractor class. For other classes, I created a user mapping file and added Client and Analyst as subclasses. How can I match the class of the Contractor?
source
share