I am updating this post with what I think I now know about setting up this configuration; HOWEVER, there is more to know, since I still have a problem, this is one important area.
I am using SQLite for unit testing, which now works just fine using the setup steps below. I also use it when I need a test run of the user interface with more data than in the test data in memory, but without SQLServer overhead - this configuration does not work with the following:
{"Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4."}
Here is updated information about the configurations that DO work:
1) What is SQLite dll ?? There are some bad links that look useful, but that have build errors in them . The only good download from this date is here at Source Forge . v1.066, which was released today, 4-18-2010.
2) Should you use the GAC? No, as Maurizio answered.
3) x64 builds - as Maurizio answered.
4) NHib driver - SQLite20Driver, as Maurizio answered
5) FNH as a potential conflict - no, as Maurizio answered
Cheers
Berryl
== ADD'L DEBUG INFO ===
When the exception is removed, and I call the SQLite20Drive assembly, I get the following, which tells me that the driver should be available. However, I am interested, since the configuration code is in a different assembly.
- build on error ----
?typeof(SQLite20Driver).Assembly {NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4} [System.Reflection.RuntimeAssembly]: {NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4} CodeBase: "file:///C:/Users/Lord & Master/Documents/Projects/Smack/trunk/src/ConstructionAdmin.WpfPresentation/bin/Debug/NHibernate.DLL" EntryPoint: null EscapedCodeBase: "file:///C:/Users/Lord%20%26%20Master/Documents/Projects/Smack/trunk/src/ConstructionAdmin.WpfPresentation/bin/Debug/NHibernate.DLL" Evidence: {System.Security.Policy.Evidence} FullName: "NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4" GlobalAssemblyCache: false HostContext: 0 ImageRuntimeVersion: "v2.0.50727" IsDynamic: false IsFullyTrusted: true Location: "C:\\Users\\Lord & Master\\Documents\\Projects\\Smack\\trunk\\src\\ConstructionAdmin.WpfPresentation\\bin\\Debug\\NHibernate.dll" ManifestModule: {NHibernate.dll} PermissionSet: {<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/> } ReflectionOnly: false SecurityRuleSet: Level1
--- assembly during unit testing (NO ERROR)
{NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4} [System.Reflection.RuntimeAssembly]: {NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4} CodeBase: "file:///C:/Users/Lord & Master/Documents/Projects/Smack/trunk/src/ConstructionAdmin.Tests/bin/Debug/NHibernate.DLL" EntryPoint: null EscapedCodeBase: "file:///C:/Users/Lord%20%26%20Master/Documents/Projects/Smack/trunk/src/ConstructionAdmin.Tests/bin/Debug/NHibernate.DLL" Evidence: {System.Security.Policy.Evidence} FullName: "NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4" GlobalAssemblyCache: false HostContext: 0 ImageRuntimeVersion: "v2.0.50727" IsDynamic: false IsFullyTrusted: true Location: "C:\\Users\\Lord & Master\\Documents\\Projects\\Smack\\trunk\\src\\ConstructionAdmin.Tests\\bin\\Debug\\NHibernate.dll" ManifestModule: {NHibernate.dll} PermissionSet: {<PermissionSet class="System.Security.PermissionSet"
version = "1" Unlimited = "true" / ">} ReflectionOnly: false SecurityRuleSet: Level1
Here is this boot script for this SQLite session:
/// <summary>SQLite-NHibernate bootstrapper for general use.</summary> public class SQLiteBoot : IDisposable { public readonly ISessionFactory SessionFactory; private readonly ISession _session; private static Configuration _config; private static string _persistenceModelGeneratorName; public SQLiteBoot(IAutoPersistenceModelGenerator persistenceModelGenerator) { if (_isSessionFactoryBuildRequired(persistenceModelGenerator)) { _config = new Configuration() .SetProperty(ENV.ReleaseConnections, "on_close") .SetProperty(ENV.Dialect, typeof (SQLiteDialect).AssemblyQualifiedName) .SetProperty(ENV.ConnectionDriver, typeof (SQLite20Driver).AssemblyQualifiedName) .SetProperty(ENV.ConnectionString, "data source=:memory:") .SetProperty(ENV.ProxyFactoryFactoryClass, typeof (ProxyFactoryFactory).AssemblyQualifiedName) .SetProperty(ENV.CurrentSessionContextClass, typeof (ThreadStaticSessionContext).AssemblyQualifiedName); _persistenceModelGeneratorName = persistenceModelGenerator.Name; var persistenceModel = persistenceModelGenerator.Generate(); var fluentCfg = Fluently.Configure(_config).Mappings(m => m.AutoMappings.Add(persistenceModel)); SessionFactory = fluentCfg.BuildSessionFactory(); Check.Require(SessionFactory.GetAllClassMetadata().Count > 0, "No mapped classes - check your AutoPersistenceModel!"); } _session = SessionFactory.OpenSession(); CurrentSessionContext.Bind(_session); new SchemaExport(_config).Execute(true, true, false, _session.Connection, Console.Out); } private bool _isSessionFactoryBuildRequired(IAutoPersistenceModelGenerator persistenceModelGenerator) { return _config == null || SessionFactory == null || !persistenceModelGenerator.Name.Equals(_persistenceModelGeneratorName); } public void Dispose() { _session.Dispose(); } }
}