Line geometry insertion fails if line contains only two idantical points

Description

I have such class:

public class Edge
{
public virtual Guid IDEdge { get; set; }
public virtual Node Source { get; set; }
public virtual Node Target { get; set; }
public virtual double Length { get; set; }
public virtual byte Car { get; set; }
public virtual byte CarReverse { get; set; }
public virtual IGeometry Geometry { get; set; }
}

...and fluent mapping:

public class EdgeMap : ClassMap<Edge>
{
public EdgeMap()
{
Table("Edges");
LazyLoad();
Id(x => x.IDEdge).GeneratedBy.GuidComb().Column("IDEdge");
References(x => x.Source).Column("Source");
References(x => x.Target).Column("Target");
Map(x => x.Length).Not.Nullable().Column("Length");
Map(x => x.Car).Not.Nullable().Column("Car");
Map(x => x.CarReverse).Not.Nullable().Column("CarReverse");
Map(x => x.Geometry).CustomType<MsSql2008GeometryType>().Not.Nullable().Column("Geom");
}
}

I tried to insert edge with geometry:

LINESTRING(5 5, 5 5)

(two points with same coordinates)

I have got:

not-null property references a null or transient value Edge.Geometry

Somewhere instance of Geometry class has been lost. Edge inserts successfully if line contains different points.

Environment

None

Activity

Show:

Ricardo Stuven 
September 20, 2011 at 12:54 AM

NHSP is not throwing a proper exception for cases like this. I'll fix that.

Ricardo Stuven 
September 19, 2011 at 11:39 PM

There is a restriction in SQL Server: A LineString must have at least two distinct points. See http://technet.microsoft.com/en-us/library/bb895372.aspx

Fixed

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created March 24, 2011 at 4:38 AM
Updated December 29, 2011 at 12:41 AM
Resolved December 29, 2011 at 12:41 AM
Who's Looking?