Question

I'm using Entity Framework 6.0.2 to map classes to database. One of classes contains DbGeography property:

public DbGeography Coordinate { get; set; }

Everything is great when I'm on SQL Server Express, but when I switch to SQL Server Compact I receive next error:

There is no store type corresponding to the EDM type 'Edm.Geography(Nullable=True)' of primitive type 'Geography'.

I found out from here that it is possible to store geography data converting it to 'image' type. But next attempt doesn't give result:

[Column(TypeName = "image")]
public DbGeography Coordinate { get; set; }

So question is: what is right way to convert geography data to image and store it in SQL Server Compact?

Was it helpful?

Solution

Since I need only Area property, I have just stored that data in WKT format as "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top