4

我使用 NHibernate 3.1 并更新到 3.2 版。我也使用 confOrm 1.0.1.5 并更新到 2.0.0.0vVersion。我的 Firebird NET Provider 版本是 2.7。我对我的代码进行了一些修改,因为 confOrm 不再包含ConfOrm.Mapper。当我尝试进行选择时,它返回以下错误:

NHibernate.HibernateException : Could not create the driver from NHibernate.Driver.FirebirdClientDriver, NHibernate, Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
  ----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
  ----> System.ArgumentException : Unable to find the requested .Net Framework Data Provider.  It may not be installed.
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings)
at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2 settings)
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties)
at NHibernate.Cfg.Configuration.BuildSettings()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at SoftManager.Dao.Util.SessionManager.get_factory() in SessionManager.cs: line 15
at SoftManager.Dao.Util.SessionManager.getSession() in SessionManager.cs: line 23
at SoftManager.Dao.GenericDao`1.findUniqueByWhere(Restricao rest, Order order) in GenericDao.cs: line 144
at SoftManager.Dao.CidadeDao.findUniqueByWhere(Restricao rest, Order order) in CidadeDao.cs: line 52
at SoftManager.Teste.TesteConsulta.consultaCidade2() in TesteConsulta.cs: line 52
at SoftManager.Teste.TesteConsulta.testes() in TesteConsulta.cs: line 17
--TargetInvocationException
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, ref Boolean canBeCached, ref RuntimeMethodHandleInternal ctor, ref Boolean bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type)
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings)
--ArgumentException
at NHibernate.Driver.ReflectionBasedDriver..ctor(String providerInvariantName, String driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.FirebirdClientDriver..ctor()

任何帮助表示赞赏,谢谢!

4

2 回答 2

2

我在 Google 上搜索了您的错误并来到Social MSDN 上的这个帖子。总结一下解决方案(向下滚动查看 Barrett 的解决方案),您的 machine.config 文件中可能有问题。该用户在他的 machine.config 中报告了一个额外的结束标记,如下所示:

<!-- notice the double closing tag -->
<system.data>
    <DbProviderFactories>
        <add name="Odbc Data Provider" invariant="System.Data.Odbc" ... />
        <add name="OleDb Data Provider" invariant="System.Data.OleDb" ... />
        <add name="OracleClient Data Provider" invariant="System.Data ... />
        <add name="SqlClient Data Provider" invariant="System.Data ... />
        <add name="IBM DB2 for i .NET Provider" invariant="IBM.Data ... />
        <add name="Microsoft SQL Server Compact Data Provider" ... /></DbProviderFactories>
    <DbProviderFactories/>
</system.data>

顺便说一句,我搜索了无法找到请求的 .Net Framework 数据提供程序。它可能没有安装。,这是报告的错误中更有趣的部分。如果以上没有帮助,还有更多有趣的发现。


进一步的研究让我看到了这篇博文,它解释了为什么在您有多个数据提供者的情况下这可能是一个问题,以及如何解决它。注意:这个StackOverflow 问题是相关的,这个问题也是相关的(解决方案也在 machine.config 中)。

于 2012-03-05T20:48:54.590 回答
0

亚伯,谢谢你的回答。我尽一切可能!每一种可能的解决方案,我都尝试重新安装 VS、Firebird、Net Framework 4 但没有任何效果,所以我格式化了我的电脑并在新版本的 nhibernate 中正常工作。

于 2012-03-06T20:00:06.440 回答