Testing SQLite Spatial Database (with NHibernate)
I am wondering what would be the best way to use NHibernate.Spatial with SQLite for testing purposes?
Mostly, I will need to be able to run NHibernate queries (HQL and others) against in-memory SQLite where Spatial is used.
This leads me to a couple of options:
- Create a fake dialect for SQLite where it would always return predefined results.
- U开发者_开发技巧se something like SpatiaLite
- Switch to a single database (which is MSSQL2008).
I guess the option 1 should fit my needs.
Option 2 will probably be an overkill and not hassle-free. Option 3 will be used in Integration tests ONLY, for unit-testing I still want to use SQLite due to the fast and easy setup.So implementing option 1 (fake SQLite dialect for spatial database) should do the job.
My questions are:
- Are there any SQLite Spatial Dialects that allow faking the results (always returning empty sets for example)?
- What other alliteratives can you see?
I would appreciate some advice.
Thanks.
If you're using Fluent NHibernate, you could use conventions to define a different user-type for persisting an IGeometry in SQLite. I've written a blog post about this solution.
精彩评论