日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

SQL Lite on NHibernate

發(fā)布時間:2023/12/18 数据库 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SQL Lite on NHibernate 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

?? 一直為在單元測試中測試mapping很糾結。現(xiàn)在用SQL Lite,不糾結了。

?? 首先這里SQL Lite,然后編寫config文件,如下

?

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"><session-factory name="NHibernate.Test"><property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property> <property name="connection.connection_string">Data Source=a.db;Version=3;New=true</property><property name="show_sql">true</property><property name="dialect">NHibernate.Dialect.SQLiteDialect</property> <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu</property> <mapping assembly="Ornament.MemberShip.Core" /> </session-factory> </hibernate-configuration>

?

??? 其中,要留意一下driver_class項,如果使用我提供的SQL Lite,就必須使用 NHibernate.Driver.SQLite20Driver。如果你是下載SQL lite msi安裝包,默認會把SQL Lite 放到GAC里面,那么測試項目中就需要設定<qualifyAssembly> 元素,又或者引用System.Data.SQLLite.dll后,把copy local 設定為true。否則就會出現(xiàn)以下異常

?

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..

轉載于:https://www.cnblogs.com/fantasylu/archive/2010/04/27/1722049.html

總結

以上是生活随笔為你收集整理的SQL Lite on NHibernate的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。