简体   繁体   English

带有NHibernate 2.1的SQL.Data.SqlLite版本

[英]SQL.Data.SqlLite version with NHibernate 2.1

What version/implementation of the SQLLite can be used with NHibernate. NHibernate可以使用SQLLite的哪个版本/实现。 I get an error: 我收到一个错误:

The IDbCommand and IDbConnection implementation in the assembly SQLite.NET could not be found. 无法找到程序集SQLite.NET中的IDbCommand和IDbConnection实现。 Ensure that the assembly SQLite.NET is located in the application directory or in the Global Assembly Cache. 确保程序集SQLite.NET位于应用程序目录或全局程序集缓存中。 If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly. 如果程序集位于GAC中,请使用应用程序配置文件中的元素指定程序集的全名。

Let me say that dll is in the bin directory, I made sure. 让我说dll在bin目录中,我确定。 I am using System.Data.SQLite.DLL version 1.0.60.0. 我正在使用System.Data.SQLite.DLL版本1.0.60.0。

Here is the hibernate.cfg.xml 这是hibernate.cfg.xml

    <property name="connection.driver_class">
        <!--NHibernate.Driver.SqlClientDriver-->
        NHibernate.Driver.SQLiteDriver
    </property>
     <property name="connection.connection_string">
        <!--    Server=.\SQLEXPRESS;User Id=epitka;Password=password;Database=dnn49;-->
        Data Source=nhibernate.db;Version=3
  </property>
  <property name="dialect">NHibernate.Dialect.SQLiteDialect</property>

  <property name="query.substitutions">true=1;false=0</property>

  <property name="show_sql">true</property>

I am running this on Window XP box. 我在Window XP盒子上运行它。

IDbCommand and IDbConnection are in the System.Data namespace, not in SQLite. IDbCommand和IDbConnection位于System.Data命名空间中,而不在SQLite中。 Would you post your nhibernate configuration settings? 你会发布你的nhibernate配置设置吗?

Here are the relevant settings 以下是相关设置

dialect = NHibernate.Dialect.SQLiteDialect, NHibernate
connection.driver_class = NHibernate.Driver.SQLite20Driver, NHibernate

SQLite20Driver is for System.Data.SQLite, while SQLiteDriver is for SQLite.NET. SQLite20Driver用于System.Data.SQLite,而SQLiteDriver用于SQLite.NET。 So SQLite20Driver is your answer. 所以SQLite20Driver就是你的答案。

I had the same problem on Windows 7 x64 , if that is the case; 我在Windows 7 x64上遇到了同样的问题,如果是这样的话; download the binary distribution of SQLite ( http://sqlite.phxsoftware.com/ ) and reference the x64 version. 下载SQLite的二进制发行版( http://sqlite.phxsoftware.com/ )并引用x64版本。

Mistery solved: 麻风解决了:

If you get the configuration template from the NHibernate's lib\\NHibernate\\Configuration_Templates folder, they you have to get the dll for sqllite from this url http://sourceforge.net/projects/adodotnetsqlite/ which is SQLite and driver is NHibernate.Driver.SQLiteDriver. 如果从NHibernate的lib \\ NHibernate \\ Configuration_Templates文件夹中获取配置模板,则必须从此URL获取sqllite的dll http://sourceforge.net/projects/adodotnetsqlite/这是SQLite,驱动程序是NHibernate.Driver。 SQLiteDriver。 But as the web site says this project is deceased. 但正如该网站所说这个项目已经死亡。

So you go and download new System.Data.SQLite.DLL from this url or from FluentNhibernate lib folder http://sourceforge.net/projects/sqlite-dotnet2/ and driver is NHibernate.Driver.SQLite20Driver 所以你从这个url或者从FluentNhibernate lib文件夹http://sourceforge.net/projects/sqlite-dotnet2/下载新的System.Data.SQLite.DLL,驱动程序是NHibernate.Driver.SQLite20Driver

See that 20 in the driver name? 在驱动程序名称中看到20?

Anyway just though I might clarify the mystery. 无论如何,尽管我可能澄清了这个谜团。

我得到了这个,但它只是我没有在我的测试项目中的引用上设置CopyLocal = True。

I also encountered this error, it's really make me crazy. 我也遇到了这个错误,它真的让我发疯了。 but I resovled it.And sharing with you,may it help you See this Link 但是我已经解除了它。并与你分享,它可以帮助你看到这个链接

Got this error trying Castle ActiveRecord with SQLite in VS2010. 在VS2010中尝试使用SQLite的Castle ActiveRecord时遇到此错误。 Solved it by following this instructions and changing the targeted framework from .NET 4 to .NET 3.5 通过遵循此说明并将目标框架从.NET 4更改为.NET 3.5来解决此问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM