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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:58:02+00:00 2026-06-18T01:58:02+00:00

I’m trying to migrate an existing HMB mapping file to Fluent mapping but have

  • 0

I’m trying to migrate an existing HMB mapping file to Fluent mapping but have come unstuck mapping the following classed (simplified).

public interface IThing
{
    int Id { get; }
    string Name { get; }
    ISettings Settings { get; }
}

public class Thing : IThing { /* Interface implementation omitted */ }

public interface ISettings
{
    string SomeNamedSetting1 { get; }
    bool SomeNamedSetting2 { get; }
    int SomeNamedSetting3 { get; }
}

public class Settings : ISettings
{
    Dictionary<string, string> rawValues;

    public string SomeNamedSetting1 { get { return rawValues["SomeNamedSetting1"]; } }
    public bool SomeNamedSetting2 { get { return Convert.ToBoolean(rawValues["SomeNamedSetting2"]); } }
    public int SomeNamedSetting3 { get { return Convert.ToInt32(rawValues["SomeNamedSetting3"]); } }
}

We code against the interface IThing and access its settings via the helper properties defined on the ISettings interface. The settings are stored in the database in one table called Setting that’s a bunch of key-value pairs with a foreign key to Thing.

The existing mapping file is as follows:

<component name="Settings" lazy="false" class="Settings, Test">
  <map name="rawValues" lazy="false" access="field" table="Setting">
    <key column="Id" />
    <index column="SettingKey" type="String" />
    <element column="SettingValue" type="String" />
  </map>
</component>

What I’m struggling with is the component definition because I can’t find the Fluent equivalent of the class attribute. Here’s what I have so far:

public class ThingMap : ClassMap<Thing>
{
    public ThingMap()
    {
        Proxy<IThing>();
        Id(t => t.Id);
        Map(t => t.Name);

        // I think this is the equivalent of the private field access
        var rawValues = Reveal.Member<Settings, IDictionary<string, string>>("rawValues");

        // This isn't valid as it can't convert ISettings to Settings
        Component<Settings>(t => t.Settings);

        // This isn't valid because rawValues uses Settings, not ISettings
        Component(t => t.Settings, m =>
        {
            m.HasMany(rawValues).
            AsMap("SettingKey").
            KeyColumn("InstanceId").
            Element("SettingValue").
            Table("Setting");
        });

        // This is no good because it complains "Custom type does not implement UserCollectionType: Isotrak.Silver.IInstanceSettings"
        HasMany<InstanceSettings>(i => i.InstanceSettings).
            AsMap("SettingKey").
            KeyColumn("InstanceId").
            Element("SettingValue").
            Table("Setting");
    }
}
  • 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-06-18T01:58:03+00:00Added an answer on June 18, 2026 at 1:58 am

    For anyone in the same boat, I cracked it eventually.

    Component<Settings>(i => i.Settings, m =>
    {
        m.HasMany(rawValues).
        AsMap<string>("SettingKey").
        KeyColumn("InstanceId").
        Element("SettingValue").
        Table("Setting");
    });
    

    Seems obvious now!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have just tried to save a simple *.rtf file with some websites and
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a reasonable size flat file database of text documents mostly saved in
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.