The change I made (to the code given in the blog) was removing the custom type.
Giving the mapping of
Map(x => x.DelytaGrans);
and it now works fine.
문제
I'm trying to set up a SQLite test database for unit tests for our FluentNhibernate ORM.
Having trouble working with the Geometry elements I've made some adjustments following a blog post: http://blogs.microsoft.co.il/dorony/2010/05/26/easy-testing-of-nhibernatespatial-code/
I'm using the latest NHibernate + FluentNhibernate along with the NHibernate.Spatial från github (https://github.com/suryapratap/Nhibernate.Spatial) - with the broken Oracle bit removed.
I have a class with a Geometry type which I have changed to:
public virtual IGeometry DelytaGrans { get; private set; }
I have mapped it with
Map(x => x.DelytaGrans).CustomType(typeof(GeometryType));
I've created a SQLiteGeometryTypeConvention and SQLiteGeometryType (as described in the blog) in my test project and call a fluently configure as follows:
var sessionFactory= Fluently.Configure()
.Database(SQLiteConfiguration.Standard.InMemory)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Delyta>()
.Conventions.Setup(x => x.Add(AutoImport.Never()))
.Conventions.Add(new SQLiteGeometryTypeConvention())
.Conventions.Add(FluentNHibernate.Conventions.Helpers.DefaultLazy.Never())
).BuildSessionFactory();
It returns an error:
----> NHibernate.MappingException : The constructor being called throws an exception.
----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> NHibernate.MappingException : A GeometryType column has been declared, but there is no spatial dialect configured
I'm not having any luck in working out what's wrong here. I've seen examples where people throw in a .Dialect in the configuration, but that seems to be with SqlServer and I've seen nothing like it for SQLiteConfiguration.
해결책
The change I made (to the code given in the blog) was removing the custom type.
Giving the mapping of
Map(x => x.DelytaGrans);
and it now works fine.