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 355301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:00:19+00:00 2026-05-12T12:00:19+00:00

My domain model is using System.Net.Uri to represent URLs, and System.Drawing.Color to represent colors.

  • 0

My domain model is using System.Net.Uri to represent URLs, and System.Drawing.Color to represent colors. In the db, uris are simply nvarchars and colours are web (hex) rgb values.

Using NHibernate, is there some way to map between these values using some custom mapper?

I don’t need to query against these items, but it would be nice if I could.

Any help is greatly appreciated.

  • 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-12T12:00:19+00:00Added an answer on May 12, 2026 at 12:00 pm

    What you need are user types. Implement IUserType or IComplexUserType (there are some more interfaces to match other needs).

    There are some examples:

    • http://intellect.dk/post/Implementing-custom-types-in-nHibernate.aspx
    • http://www.lostechies.com/blogs/rhouston/archive/2008/03/23/mapping-strings-to-booleans-using-nhibernate-s-iusertype.aspx

    Using the user type, you can map any class to any number of columns of any type. Implementing the user type means implementing the mapping between them.

    The mapping could look like this:

    <property "MyColor" type="ColorUserType">
      <column name="R"/>
      <column name="G"/>
      <column name="B"/>
    </property>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a domain model object which has properties of type System.DateTimeOffset. I'm using
I'm building an application with a domain model using CQRS and domain events concepts
I am trying to automap my domain model using fluent nhibernate. In this particular
Say I have a nice domain model, using (constructor) DI where needed. Now I
I'm using ruby 1.9.2 and rails 3.2.2. I have a 'domain' model (domain.rb): class
I am trying to model a simple domain by using DDD. Database layer is
I am creating the domain model in my system. When designing my model objects,
I'm using AutoMapper to map domain entities to view models in an Asp.Net MVC
I need to implement a pub/sub system within a domain model. I was thinking
My domain model is this: we have a bunch of schools as the root

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.