ActiveRecord,NHibernate和PostgreSQL

| 我有点卡在这里,无法正常工作。看起来很简单,但是我一定做错了。 我有一个简单的类来测试NHibernate Active Record和PostgreSQL,看看
[ActiveRecord]
public class Accident:ActiveRecordBase<Accident>
{
    [PrimaryKey(PrimaryKeyType.Sequence)]
    public int Id { get; set; }

    [Property]
    public string Address { get; set; }

    [Property]
    public int AddressNumber { get; set; }

    [Property]
    public testAccidentType AccidentType { get; set; }
}

public enum testAccidentType
{
    FRONT,
    BACK,
    SIDE
}
我正在尝试从我的类中创建模式,如下所示:
public class Startup
{
    public static void StartActiveRecord()
    {
        XmlConfigurationSource source = new XmlConfigurationSource(@\"c:\\users\\h\\documents\\visual studio 2010\\Projects\\TestNHibernate\\TestNHibernate\\Model\\config.xml\");
        ActiveRecordStarter.Initialize(source, GetActiveRecordTypes());

        ActiveRecordStarter.CreateSchema();
    }

    public static Type[] GetActiveRecordTypes()
    {
        List<Type> types = new List<Type>()
        {
            typeof(Accident)
        };
        return types.ToArray();
    }
}
ActiveRecord可以初始化此类,但始终卡在CreateSchema方法中。这是配置文件。专家有什么建议吗?
<?xml version=\"1.0\" encoding=\"utf-8\" ?>

<activerecord isWeb=\"false\">
  <config>
    <add key=\"connection.driver_class\" value=\"NHibernate.Driver.NpgsqlDriver\" />
    <add key=\"connection.connection_string\" value=\"Server=localhost;initial catalog=nhiber;User ID=postgres;Password=***;\" />
    <add key=\"connection.provider\" value=\"NHibernate.Connection.DriverConnectionProvider\" />
    <add key=\"dialect\" value=\"NHibernate.Dialect.PostgreSQLDialect\" />
  </config>
</activerecord>
编辑:我想通了这一点。问题是文档错误。 PostgreSQL不使用关键字“初始目录”,而是使用“数据库”,如下所示:
    <add key=\"connection.connection_string\" value=\"Server=localhost;database=nhiber;User ID=postgres;Password=***;\" />
谢谢!     
已邀请:
        您需要更改连接字符串:
<add key=\"connection.connection_string\" value=\"Server=localhost;database=nhiber;User ID=postgres;Password=***;\" />
    

要回复问题请先登录注册