SQLite: sqlite3.dll vs System.Data.SQLite.dll?

2019-02-13 20:53发布

问题:

What do I need to use SQLite with NHibernate (and FluentNHibernate) ?

There is:

System.Data.SQLite.dll and System.Data.SQLite.Linq.dll, (ADO.NET 2.0 provider) available from http://sourceforge.net/projects/sqlite-dotnet2/

and

sqlite3.dll available as binary download http://www.sqlite.org/download.html

What is the difference? Do I need both, or which one?

The first option installs to C:/...Program Files. Can I copy it from there to my custom SharedLibs folder, or will something reference the files originally installed?

回答1:

You only need System.Data.SQLite.dll. You could reference this assembly in your SharedLibs folder and it should be enough. The sqlite3.dll is unmanaged code containing the databae engine itself and it is embedded as resource inside the managed System.Data.SQLite assembly. Also because of this unmanaged code there are actually two versions of the System.Data.SQLite assembly: one for x86 and one for x64, so make sure you reference the correct one for your system.

You could download this assembly from here: http://sqlite.phxsoftware.com/