J'utilise le dernier NHibernate 2.1.0Beta2. Je suis en train de test unitaire avec SQLite et ont la configuration définie comme:Comment configurer SQLite pour qu'il s'exécute avec NHibernate où l'assembly résout System.Data.SQLite?
Dictionary<string, string> properties = new Dictionary<string, string>();
properties.Add("connection.driver_class", "NHibernate.Driver.SQLite20Driver");
properties.Add("dialect", "NHibernate.Dialect.SQLiteDialect");
properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
properties.Add("query.substitutions", "true=1;false=0");
properties.Add("connection.connection_string", "Data Source=test.db;Version=3;New=True;");
properties.Add("proxyfactory.factory_class",
"NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu");
configuration = new Configuration();
configuration.SetProperties(properties);
Lorsque je tente de l'exécuter, je reçois l'erreur suivante:
NHibernate.HibernateException: The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. Ensure that the assembly System.Data.SQLite is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use <qualifyAssembly/> element in the application configuration file to specify the full name of the assembly.
at NHibernate.Driver.ReflectionBasedDriver..ctor(String driverAssemblyName, String connectionTypeName, String commandTypeName) in c:\CSharp\NH\nhibernate\src\NHibernate\Driver\ReflectionBasedDriver.cs: line 26
at NHibernate.Driver.SQLite20Driver..ctor() in c:\CSharp\NH\nhibernate\src\NHibernate\Driver\SQLite20Driver.cs: line 28
Il semble donc que j'ai besoin faire référence directement à l'assemblage. Comment est-ce que je ferais ceci donc je ne reçois plus cette erreur?
J'ai téléchargé le dernier assemblage à partir d'ici: http://sourceforge.net/projects/sqlite-dotnet2.
au cas où quelqu'un se rend dans cette question et est à la recherche d'une version mise à jour de cette réponse -
Le message dans mon blog sur cette question exacte est beaucoup plus à jour que les réponses ici ...
[http: // debuggerstepthrough.blogspot.co.il/2011/08/unit-testing-fluentnhibernate.html](http://debuggerstepthrough.blogspot.co.il/2011/08/unit-testing-fluentnhibernate.html) – gillyb
Est-ce le code de sqlite-dotnet2 dans le répertoire de l'application? (Ou enregistré dans le GAC?) – Jay
je une référence à System.Data.SQLite.DLL dans mes références du projet. Je suppose que lorsque j'exécute le test unitaire (par le biais du testeur de l'unité Resharper), il le copie. –