Sometimes you receive a User Story/Requirement where users want to dynamically create and add custom columns to your application. One solution is to predefine a set of custom columns in your database like ExtraColumn1, ExtraColumn2,… but first of all this limits the user in the number of additional fields that can be added, but also doesn’t look very nice on your beautiful Entity Relation Diagram(ERD)
A better solution can be found in the EAV model (Entity- Attribute- Value model), where you model part of your database to a flexible storage mechanism. Of course, if you are using a No-SQL solution this ain’t much of a problem, but with a relational database and an ORM tool like NHibernate you still have some work to do.
The simplest way is to take advantage of the dynamic-component feature of NHibernate: