测试例外是:
测试方法DevLair.Tests.GenerateSchema_Fixture.Can_generate_schema>抛出异常: NHibernate.HibernateException:
key = value参数在ConnectionString
中不正确参数名称:初始目录---> System.ArgumentException:key = valuergument在ConnectionString
中不正确hibernate.cfg.xml是:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>
<property name="connection.connection_string">
Server=postgres48.1gb.ru;initial catalog=xgb_dlusers;User ID=xgb_dlusers;Password=****;
</property>
<property name="dialect">NHibernate.Dialect.PostgreSQLDialect</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
</hibernate-configuration>
初始目录有什么问题?
答案 0 :(得分:2)
通过错误的外观,连接字符串无效。
下面是一个示例Npgsqldriver连接字符串:
Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;
您可能遇到的问题:
Database
代替initial catalogue
(这很可能是问题)User Id
代替U ser ID
(不知道是否区分大小写)