开发者

To use SQLite in memory with NHibernate, do I have to install anything?

开发者 https://www.devze.com 2022-12-12 17:45 出处:网络
I know NHibernate has a driver for SQLite, but what do I have to install locally to use the in-me开发者_如何学编程mory version?Take a look at this

I know NHibernate has a driver for SQLite, but what do I have to install locally to use the in-me开发者_如何学编程mory version?


Take a look at this

SQL.Data.SqlLite version with NHibernate 2.1


No you don't have to install anything when you want to run in-memory. Just reference the dll (copy-local true)

The name of the dll is System.Data.SQLite.dll You can download it at source forge

I started using sqllite in-memory when I was browsing through the FluentNhibernate examples. So I copied it from FluentNhibernate. I use the following configuration:

FluentConfiguration configuration = Fluently.Configure()
  .Database(() =>
    SQLiteConfiguration.Standard
     .InMemory()
     .ProxyFactoryFactory("NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle")
     .Mappings(mappingConfiguration => mappingConfiguration
     .FluentMappings
     .AddFromAssemblyOf<User>()); 
SessionSource sessionSource = new SingleConnectionSessionSourceForSQLiteInMemoryTesting(configuration);
ISession session = sessionSource.CreateSession()


Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4

Solution:

Please do some settings in Testsettings: choose Hosts --> choose Run tests in 32 bit or 64 bit process --> choose "Run tests in 64 bit process on 64 bit machine"

Thats it. That works or me.

Hoping I could help.

merry coding

0

精彩评论

暂无评论...
验证码 换一张
取 消