tags:

views:

13

answers:

0

I have the following requirement:

User Table

  • UserID int (PK)
  • UserName string

Configuration Table

  • ConfigID int (PK)
  • ConfigName string
  • DefaultConfigValue string

UserConfig

  • UserID int (PK)
  • ConfigID int (PK)
  • ConfigValue string

How can I define my NHibernate mapping to load all of the configuration with the user value if configured?

Eg.

ConfigID  | DefaultValue 
----------+-------------
1         | 100 
2         | Test


UserID  | ConfigID   |Value
--------+------------+-----
1       | 1          |200

If User 1 logs in then my config table should have the value:

ConfigId | Value
---------+------
1        | 200
2        | Test