JAG
JAG

Reputation: 33

WCF Data Services with Geospatial

I am trying to use a WCF Data service that is based on a model that is from Entity Framework. I have 2 entities that use a data type of Geography, when I try and access the service I get the error of :

The property 'geoPoint' on type 'StoreLocations' is of type 'Geography' which is not a supported primitive type.

I see here that I the past CTP releases there was not any support for using Entity spatial types in the data services

But it would seem that has been corrected with the current release.

From what I am reading both WCF Data Services 5.3 and Entity Framework 5.0 spatial data types should be compatible, so what am I missing? I don’t have any need for the properties in the Data service but I am using them in a regular WCF service that is based on the same model. I would like to avoid maintaining 2 different models for the services.

Upvotes: 1

Views: 643

Answers (2)

Guy
Guy

Reputation: 1444

I wrote a workarround about this. The solution is to define wrappers which define a common data model for both types. http://www.odata.org/blog/how-to-use-sql-spatial-data-with-wcf-odata-spatial/

Upvotes: 2

ArTrejo-MSFT
ArTrejo-MSFT

Reputation: 171

Unfortunately, the spatial type system in WCF Data Services and the spatial types in Entity Framework are not compatible.

WCF DS does not support using spatial types in an underlying EF model.

Upvotes: 1

Related Questions