0
votes

I'm using NHibernate for the Data Access Layer (DAL) in a c# solution. Note, I've used Hibernate and NHibernate successfully in many instances, but this is the first time with a Postgres DB. Below is my NHibernate configuration XML file and the associated sessionBuilder. I'm getting the following error, which is raised on the BuildSessionFactory() method call. I've tried a hundred variations of the connection string, to no avail. Any ideas where I'm wrong here?

[ArgumentException: key=value argument incorrect in ConnectionString 
Parameter name: data source]

Here is the XML config:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
   <session-factory>
        <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
        <property name="dialect">NHibernate.Dialect.PostgreSQLDialect</property>
        <property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>
        <property name="connection.connection_string_name">server=1.1.1.1;port=8060;database=workgroup;user id=tab;password=***;</property>
<property name="current_session_context_class">web</property>
<mapping assembly="ClientAnalyticsDashboard"/>
</session-factory>
</hibernate-configuration>

Here is the code (error occurs on the last line shown):

Configuration configuration = new Configuration();
configuration.AddAssembly(Assembly.GetCallingAssembly());
configuration.Proxy(p => { p.Validation = false; });
TabSessionFactory = configuration.BuildSessionFactory();
1

1 Answers

1
votes

I think you need to change connection.connection_string_name to connection.connection_string