Thursday, August 04, 2011

Using schema with NHibernate and SqlLite

Some time ago I blogged about a technique to use SqLite in Unit testing when you have nhibernate mapping that targets Sql Server tables in a schema different from dbo. The problem was: if you specify the schema name in the mapping of a class, then you are not able to execute the test in SqLite database.

Ex. if you have this mapping.

image_thumb.png

This is a mapping for a table called EngagementView in a schema called report and when u try to run some test on this entity with SqLite you got an error telling that there is no report database. The solution is to use the schema element of the mapping. The right schema should be

<class name="xxxxx" 
          schema="report" table="EngagementView" />

Read more: Alkampfer's Place
QR: https://chart.googleapis.com/chart?chs=80x80&cht=qr&choe=UTF-8&chl=http://www.codewrecks.com/blog/index.php/2011/08/02/using-schema-with-nhibernate-and-sqllite/

Posted via email from Jasper-Net