Computed properties in NHibernate
- by Liron Levi
I'm having a problem in mapping an existing data class member to the database..
I have a database table where one of the columns is a string type, but actually stores a comma separated list of numbers. My data class shows this field as a list of integers.
The problem is that I couldn't find any hook in NHibernate that allows me to invoke the custom code that is required to replace the string field by the list and vice versa.
To illustrate (simplified of course):
The database table:
CREATE TABLE dummy (
id serial,
numlist text -- (can store values such as '1,2,3')
)
The data class:
class Dummy {
public int Id;
public List<int> NumbersList;
}
Can anyone help?