Computed properties in NHibernate
        Posted  
        
            by Liron Levi
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Liron Levi
        
        
        
        Published on 2010-03-08T07:24:44Z
        Indexed on 
            2010/03/08
            7:36 UTC
        
        
        Read the original article
        Hit count: 391
        
nhibernate
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?
© Stack Overflow or respective owner