Hi All,

I'm pretty new to NHibernate and I'm having some odd problems getting
this to work as expected.  The error I'm seeing is:

NHibernatException: "Could not find the named connection string
LalPacConn"

I have followed this guide 
http://www.martinwilley.com/net/code/nhibernate/appconfig.html
and I have seen the same information posted elsewhere and I can
confirm that my app.config is setup as it should be.  I have even
copied in the following line from the NHibernate source code:

System.Configuration.ConnectionStringSettings connectionStringSettings
=
System.Configuration.ConfigurationManager.ConnectionStrings["LalPacConn"];

This is a line taken from the GetNamedConnectionString method and this
works perfectly on my app.config

                protected virtual string
GetNamedConnectionString(IDictionary<string, string> settings)
                {
                        string connStringName;
                        
if(!settings.TryGetValue(Environment.ConnectionStringName, out
connStringName))
                                return null;

                        ConnectionStringSettings connectionStringSettings =
ConfigurationManager.ConnectionStrings[connStringName];
                        if (connectionStringSettings == null)
                                throw new 
HibernateException(string.Format("Could not find named
connection string {0}", connStringName));
                        return connectionStringSettings.ConnectionString;
                }

The particular bit of my config looks like:

      <property name="connection.connection_string_name">
        LalPacConn
      </property>

  <connectionStrings>
    <add name="LalPacConn" connectionString="removed for security
reasons" />
  </connectionStrings>

Needless to say that I'm at a total loss at the moment, I can't see
any problems and I've proved that the bit of NHibernate code in
question works on my app.config file, if anyone has any suggestions I
would be really grateful.  We're using NHibernate v2.0.0.1001

Regards,

Jammer

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to