2

Is it possible to map a class with each property stored as a row in the table, not a column. The scenario is where we persist global options to the database. We store the options in an 'Options' class that has a property per option, i.e. "Expand Menu", "Save on Exit" etc.

Rather than store each option in its own table column, we would simply like to have a table with each of the class properties stored as a new row, identified by a Enum.

Is this possible?

(C# Winforms)

Josata
  • 173
  • 2
  • 8

1 Answers1

1

Using NHibernate's EntityMode.Map might help solve this problem. It does mean that you might have to put your global options in a Dictionary collection, but you can always implement an Option class that abstracts the underlying Dictionary.

NHibernate provides the ability to map a Dictionary dynamically to a table. See NHibernate's reference on Dynamic Models

Philip Fourie
  • 111,587
  • 10
  • 63
  • 83