开发者

Testing SQLite Spatial Database (with NHibernate)

开发者 https://www.devze.com 2023-01-24 06:08 出处:网络
I am wondering what would be the best way to use NHibernate.Spatial with SQLite for testing purposes?

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:

  1. Create a fake dialect for SQLite where it would always return predefined results.
  2. U开发者_开发技巧se something like SpatiaLite
  3. 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:

  1. Are there any SQLite Spatial Dialects that allow faking the results (always returning empty sets for example)?
  2. 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.

0

精彩评论

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