Improve exception message for missing properties
Description
Environment
None
Activity
Show:

Fabio Maulo May 18, 2009 at 11:20 AM
Programmatically you can add other custom properties.
The breaking change was described in releasenotes.txt
Others are available here
http://nhforge.org/wikis/reference2-0en/from-1-0-to-1-2.aspx
http://nhforge.org/wikis/reference2-0en/from-nh1-2-1ga-to-nh2-0-0.aspx
Won't Fix
Details
Details
Assignee
Unassigned
UnassignedReporter

Components
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created May 18, 2009 at 6:01 AM
Updated May 18, 2009 at 11:20 AM
Resolved May 18, 2009 at 11:20 AM
Who's Looking?
I had some old code (NHibernate 1.0.2) that initialized by using the following:
configurationProperties.Add("hibernate.dialect", "NHibernate.Dialect.MsSqlCeDialect");
I'm just migrating my project to 2.1.0Alpha2 and I got the following very confusing exception:
System.InvalidOperationException: Could not find the dialect in the configuration
at NHibernate.Dialect.Dialect.GetDialect(IDictionary`2 props)
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties)
at NHibernate.Cfg.Configuration.BuildSettings()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
This could be made clearer. As it stands "could not find the dialect in the configuration" could mean one of two things:
1. The dialect named in the configuration could not be found (because of missing dependencies, or because it's not a recognised dialect)
2. The configuration doesn't contain a setting for the dialect.
I spent a fair bit time assuming that it was the first option (because this is a new box, and I wasn't sure if everything was installed correctly), when it was actually the second meaning.
I suggest changing the text to something like: "The configuration does not define a property named 'dialect'". Then I'd have known that the syntax for properties had changed.