Finsar. SQLite. sqliteconnection
Situation: I want to store a small amount of data in the database,
2, and use nhib.pdf
Nhib.pdf does not support access well, so I chose to use SQLite. However, the same code can be passed on ms SQL Server, but it does not pass SQLite, step by step, we can find that the SQLite constructor is as follows:
Public sqlitedriver (): Base (
"SQLite. Net ",
"Finsar. SQLite. sqliteconnection ",
"Finsar. SQLite. sqlitecommand ")
{
}
After checking, I used the DLL in http://sourceforge.net/projects/sqlite-dotnet2.
The SQLite DLL used in SQLite in nhib.pdf is actually used.
Http://sourceforge.net/projects/adodotnetsqlite,
Because the DLL is incorrect, the error "cannot create driver from ***" is often reported. When using this version, we should copy the sqlite3.dll to the execution directory, otherwise, an error occurs.
This is the configuration file used when SQLite is used. (Note: This file is only applicable to nhibbench 1.2. For other versions, see this document)
<? XML version = "1.0" encoding = "UTF-8"?>
<Configuration>
<Configsections>
<Section name = "Nhibernate" type = "system. configuration. namevaluesectionhandler, system, version = 1.0.5000.0, culture = neutral, publickeytoken = b77a5c561934e089"/>
<Section name = "log4net" type = "log4net. config. log4netconfigurationsectionhandler, log4net"/>
</Configsections>
<Nhib.pdf>
<! --
<Add key = "hibernate. show_ SQL"
Value = "true"/>
<Add key = "hibernate. Connection. provider"
Value = "nhib.pdf. Connection. driverconnectionprovider"/>
<Add key = "hibernate. dialect"
Value = "nhibect. dialect. mssql2000dialect"/>
<Add key = "hibernate. Connection. driver_class"
Value = "nhib.pdf. Driver. sqlclientdriver"/>
<Add key = "hibernate. Connection. connection_string"
Value = "Server =. cxy; database = mytest; uid = sa; Pwd = cxy"/>
-->
<Add key = "hibernate. show_ SQL"
Value = "true"/>
<Add key = "hibernate. Connection. provider"
Value = "nhib.pdf. Connection. driverconnectionprovider"/>
<Add key = "hibernate. dialect"
Value = "nhib.pdf. dialect. sqlitedialect"/>
<Add key = "hibernate. Connection. driver_class"
Value = "nhib.pdf. Driver. sqlitedriver"/>
<Add key = "hibernate. Connection. connection_string"
Value = "Data Source = cxy. DB; version = 3"/>
<Add key = "hibernate. query. substitutions"
Value = "true = 1; false = 0"/>
</Nhib.pdf>
<! -- This section contains the log4net configuration settings -->
<Log4net>
<! -- Define some output appenders -->
<Appender name = "rollingfile" type = "log4net. appender. rollingfileappender, log4net">
<Param name = "file" value = "log.txt"/>
<Param name = "appendtofile" value = "true"/>
<Param name = "rollingstyle" value = "date"/>
<Param name = "datepattern" value = "YYYY. Mm. dd"/>
<Param name = "staticlogfilename" value = "true"/>
<Layout type = "log4net. layout. patternlayout, log4net">
<Param name = "conversionpattern" value = "% d [% T] %-5 p % C [% x] & lt; % x {auth} & gt; -% m % N "/>
</Layout>
</Appender>
<! -- Setup the root category, add the appenders and set the default priority -->
<Root>
<Priority value = "all"/>
<Appender-ref = "rollingfile"/>
</Root>
</Log4net>
</Configuration>