I am creating the security system for the software im creating and I would like to know how i can do the following in NHibernate(if at all possible)
User Account Class:
public class UserAccount { public virtual int UserID { get; set; } public virtual String Username { get; set; } public virtual Privilege InvoicePrivilege { get; set; } public virtual Privilege TradePrivilege { get; set; } } Privilege Class:
public class Privilege { public virtual bool Read { get; set; } public virtual bool Write { get; set; } public virtual bool Delete { get; set; } public virtual bool Modify { get; set; } } I will be having a large number of these privilege objects (one for each traded entity) so in the database i have the following tables:
UserAccounts ( UserID, Username)
Privileges (UserID, PrivilegeType, Read,Write,Modify,Delete)
How can I map the InvoicePrivielge property from the user account to the (UserID, 'Invoice') Privilege.
I could do this using many-to-one but I don't want a collection of privileges, i'd rather map it to its property.