Fluent NHibernate mapping List<Point> as value to single column
- by Paja
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.