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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:21:13+00:00 2026-06-04T04:21:13+00:00

I am trying to create an application-wide Settings table: Settings Name | Value ————————–

  • 0

I am trying to create an application-wide Settings table:

Settings

Name     | Value
--------------------------
Config1  | "A text string"
Config2  | "true"
Config3  | "100"

Name and value are both varchar type. I’m trying to map this to a Dictionary object in some way in a Settings class:

public class ApplicationSettings 
{
    protected virtual void IDictionary Settings { get; set; }

    public string Config1 {
        get { return Settings["Config1"]; }
        set { Settings["Config1"] = value; }
    }
    // etc
}

Note: This prior question is the closest I can find to what I’m trying to do, but it doesn’t show the NHibernate mapping used.

I know that NHibernate has a <map/> tag, so that I can attach just such a dictionary to another mapped object (for instance a UserSettings dictionary mapped to a User class). But in my case, these are global settings, so there is no parent object to attach to.

Can anyone explain what the mapping would look like for this situation, or if the <map/> tag can’t be used, some other way (criteria query, named SQL query) to load and save from this type of table?

  • 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-04T04:21:14+00:00Added an answer on June 4, 2026 at 4:21 am
    public class Setting
    {
        public virtual For Id { get; set; }
        public string Value { get; set; }
    }
    
    public enum For
    {
        Config1,
        Config2,
    }
    
    
    // initialize once
    void LoadSettings(ISession session)
    {
        Application.Settings = session.Query<Setting>().AsEnumerable().ToDictionary(s => s.Id, s => s.Value);
    }
    
    // get on demand with caching
    var config1 = session.Get<Setting>(For.Config1).Value;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create an application which requires a two table SQLite database
I am trying to create an application that changes the value of the button
Im trying to create application from scratch. In new maven project i add a
I am trying to create an application that makes a window (external to the
I'm trying to create an application where there is a JSplitPane which contains the
I'm trying to create an application that uses the iPhone MapView (under Google Code).
I'm trying to create an application in interface builder, and I'm having a problem.
I am trying to create an application can modify properties in IL to create
I am trying to create an application to take advantage of OpenSSH to create
I am trying to create an application bar in code for WinPhone7. The XAML

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.