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

  • Home
  • SEARCH
  • 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 6018333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:15:37+00:00 2026-05-23T03:15:37+00:00

Are there any tools available, or perhaps utility methods within NHibernate, which may help

  • 0

Are there any tools available, or perhaps utility methods within NHibernate, which may help me to nail down which mapping is throwing a “The given key is not present in the dictionary”?

I understand that I must have a bad mapping, but I have hundreds of domain objects. What can I do to locate the source of my error more quickly?

From the NHibernate 2.1.2GA Source:

private PersistentClass GetPersistentClass(string className)
{
    PersistentClass pc = configuration.classes[className]; // <- "The given key was not present in the dictionary"
    if (pc == null)
    {
     throw new MappingException("persistent class not known: " + className);
    }
    return pc;
}

And in this case, className is System.Int32.

Ok, so I had an int field marked <many-to-one> instead of <property>. I ended up digging up the source for NH and debugging to get to this point.

  • 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-23T03:15:38+00:00Added an answer on May 23, 2026 at 3:15 am

    NHibernate Mapping: Creating Sanity Checks

    [Test]
    public void AllNHibernateMappingAreOkay()
    {
       IDictionary allClassMetadata = session.SessionFactory.GetAllClassMetadata();
       foreach (DictionaryEntry entry in allClassMetadata)
       {
            session
                .CreateCriteria((Type) entry.Key)
                .SetMaxResults(0)
                .List();
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any tools available for querying attributes defined for methods/classes? It would be
Are there any tools available that will calculate code metrics (for example number of
Are there any tools available for validating a database schema against a set of
With a seriously big .NET site/solution (100's of assemblies), are there any tools available
Are there any plugins/tools available to go through the classpath of an eclipse project
How do I create XSD from an Oracle Table? Are there any tools available
For memory leaks, there are many tools available such as valgrind, which you can
Are there any tools available for Visual Studio that can inform the programmer about
Is there any UI Automation tools available for iOS that don't require the iOS
Is there any free tool available for creating and editing PNG Images?

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.