Fluent nhibernate 使用Fluent NHibernate连接到Postgres会引发异常

Fluent nhibernate 使用Fluent NHibernate连接到Postgres会引发异常,fluent-nhibernate,npgsql,Fluent Nhibernate,Npgsql,以下是我的休眠设置: FluentConfiguration configuration = Fluently.Configure() .Database(PostgreSQLConfiguration.Standard.ConnectionString(c => c .Host("localhost") .Port(5432) .Database

以下是我的休眠设置:

FluentConfiguration configuration = Fluently.Configure()
            .Database(PostgreSQLConfiguration.Standard.ConnectionString(c => c
                    .Host("localhost")
                    .Port(5432)
                    .Database("PEDAux")
                    .Username("ped_admin")
                    .Password("xxxxx"))
                .ShowSql)
            .Mappings(m => m.FluentMappings
                .AddFromAssembly(Assembly.GetExecutingAssembly())
                .Conventions.Add<TableNameConvention>()
                .Conventions.Add<ColumnNameConvention>()
            )
            .ExposeConfiguration(x =>
            {
                // TODO: Not yet sure what to put in here
            });

        return configuration.BuildSessionFactory();
FluentConfiguration=Fluently.Configure()
.Database(PostgreSQLConfiguration.Standard.ConnectionString(c=>c
.Host(“本地主机”)
.港口(5432)
.数据库(“PEDAux”)
.Username(“ped_admin”)
.密码(“xxxxx”))
.ShowSql)
.Mappings(m=>m.FluentMappings
.AddFromAssembly(Assembly.getExecutionGassembly())
.Conventions.Add()
.Conventions.Add()
)
.ExposeConfiguration(x=>
{
//托多:还不知道在这里放什么
});
返回configuration.BuildSessionFactory();
我得到以下错误:

内部异常1: HibernateException:无法从NHibernate.driver.NpgsqlDriver创建驱动程序,NHibernate,版本=5.2.0.0,区域性=中性,PublicKeyToken=aa95f207798dfdb4

内部例外2: TargetInvocationException:调用的目标已引发异常

内部例外3: ArgumentException:找不到请求的.Net Framework数据提供程序。它可能没有安装

当我使用SQLServer时,同一组配置似乎可以工作。当然,对于SQLServer,我使用的是SQLServer配置对象。 Project正在.NET版本=v4.7.2上运行。请参见:

要使用此驱动程序,必须具有Npgsql.dll程序集 可供NHibernate加载


根据错误,您似乎没有,或者如果有,您的项目中没有引用它。

我非常确定我有npgsql.dll(v4.0.6)安装是因为我使用了Nuget package manager。它确实在项目中被正确引用。在这种情况下,我认为在有人帮助您之前,您的问题中需要更多信息。错误似乎表明它与驱动程序引用本身有关。其他要检查的事项:和