Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 753691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:55:36+00:00 2026-05-14T14:55:36+00:00

I have this class: public class MyEntity { public virtual int Id { get;

  • 0

I have this class:

public class MyEntity
{
    public virtual int Id { get; set; }
    public virtual IList<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 IList<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 IList<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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:55:36+00:00Added an answer on May 14, 2026 at 2:55 pm

    Found an answer. 🙂

    Heading UserTypeConvention<T> at:
    http://wiki.fluentnhibernate.org/Available_conventions
    for custom type conversions.

    This is for implementing custom type convertors:
    http://intellect.dk/post/Implementing-custom-types-in-nHibernate.aspx

    Additional related links I’ve found:
    http://www.lostechies.com/blogs/rhouston/archive/2008/03/23/mapping-strings-to-booleans-using-nhibernate-s-iusertype.aspx
    http://www.martinwilley.com/net/code/nhibernate/usertype.html
    Link
    http://kozmic.pl/archive/2009/10/12/mapping-different-types-with-nhibernate-iusertype.aspx
    Link

    UserTypeConvention<T> usage:
    http://jagregory.com/writings/fluent-nhibernate-auto-mapping-type-conventions/

    The most important code in last link is this:

    public class ReplenishmentDayTypeConvention : ITypeConvention
    {
      public bool CanHandle(Type type)
      {
        return type == typeof(ReplenishmentDay);
      }
    
      public void AlterMap(IProperty propertyMapping)
      {
        propertyMapping
          .CustomTypeIs<ReplenishmentDayUserType>()
          .TheColumnNameIs("RepOn");
      }
    }
    

    Where ReplenishmentDayUserType is IUserType-derived class and ReplenishmentDay is the class, which should be converted using your user type converter.

    And this:

    autoMappings
      .WithConvention(convention =>
      {
        convention.AddTypeConvention(new ReplenishmentDayTypeConvention());
        // other conventions
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this class. public class Foo { public Guid Id { get; set;
I have this class called Table: class Table { public string Name { get
I have some classes layed out like this class A { public virtual void
This is probably not possible, but I have this class: public class Metadata<DataType> where
I have this method in my db class public function query($queryString) { if (!$this->_connected)
I have a class like this: public class Stretcher : Panel { public static
I have a class like this: public class myClass { public List<myOtherClass> anewlist =
I have an action like this: public class News : System.Web.Mvc.Controller { public ActionResult
I have a class that looks like this public class SomeClass { public SomeChildClass[]
I have a class which looks something like this: public class Test { private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.