Я прочитал это, чтобы скомпилировать NH пространственное для Nhibernate 3.1
http://build -failed.blogspot.it / 2012/02 / nhibernate -atial-part-2.html
Я также прочитал это
NHibernate.Spatial и Sql 2008 Тип географии - Как настроить
, но тот же код для меня нет компилировать ... У меня есть
using NetTopologySuite.Geometries;
namespace Core
{
public class District
{
public virtual int Id { get; set; }
public virtual Polygon Area { get; set; }
public virtual string Name { get; set; }
}
}
using Core;
using FluentNHibernate.Mapping;
namespace TestNHSpatial
{
public class DistrictMap : ClassMap<District>
{
public DistrictMap()
{
ImportType<NetTopologySuite.Geometries.Point>();
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.Area).CustomType<Wgs84GeographyType>();
}
}
}
и это
[Serializable]
public class Wgs84GeographyType : MsSql2008GeographyType
{
protected override void SetDefaultSRID(GeoAPI.Geometries.IGeometry geometry)
{
geometry.SRID = 4326;
}
}
наконец
var cfg = new OrderingSystemConfiguration();
var configuration = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008
.ConnectionString(connString)
.Dialect<MsSql2008GeographyDialect>())
.Mappings(m => m.AutoMappings.Add(
AutoMap.AssemblyOf<District>(cfg)))
.BuildConfiguration();
var exporter = new SchemaExport(configuration);
exporter.Drop(false, true);
exporter.Create(true, true);
У меня есть эта ошибка ...
NHibernate.MappingException: ассоциация из таблицы District относится к не отображенному классу: NetTopologySuite.Geometries.Polygon
кто-нибудь может мне помочь?
спасибо