Fluent NHibernate mapping List<Point> as value to single column

Posted by Paja on Stack Overflow See other posts from Stack Overflow or by Paja
Published on 2010-05-02T16:41:42Z Indexed on 2010/05/02 16:47 UTC
Read the original article Hit count: 329

I have this class:

public class MyEntity
{
    public virtual int Id { get; set; }
    public virtual List<Point> Vectors { get; set; }
}

How can I map the Vectors in Fluent NHibernate to a single column (as value)? I was thinking of this:

public class Vectors : ISerializable
{
    public List<Point> Vectors { get; set; }

    /* Here goes ISerializable implementation */
}

public class MyEntity
{
    public virtual int Id { get; set; }
    public virtual Vectors Vectors { get; set; }
}

Is it possible to map the Vectors like this, hoping that Fluent NHibernate will initialize Vectors class as standard ISerializable?

Or how else could I map List<Point> to a single column? I guess I will have to write the serialization/deserialization routines myself, which is not a problem, I just need to tell FNH to use those routines.

I guess I should use IUserType or ICompositeUserType, but I have no idea how to implement them, and how to tell FNH to cooperate.

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about nhibernate