1

I'm getting this error on an OData Web Service, when the Entities of the model I'm using include fields of type SqlGeometry. If I remove the SqlGeometry fields of the classes that implement it, the connection using DbContext is established and I can use the oData Web service.

But if I include the attributes of type SqlGeometry in the classes, I obtain this error.

error 3004: Problem in mapping fragments starting at line 260:No mapping specified for properties SystemElement.LatLongGeo in Set SystemElements.
An Entity with Key (PK) will not round-trip when:
  Entity is type [ProjectoData.Models.SystemElement]

I read about it in this threads:

Error 3004: Problem in mapping fragment starting at line

and also this one:

Mapping SqlGeography using Entity Framework code first

It seemed that the Entity framework did not support it in the past, but nowadays it is supporting it.

My doubt is if this is actually supported. I installed the Nuget package Microsoft.SqlServer.Types (Spatial) version 11.0.2 on my project within the solution and I also installed the Microsfot SQL Server 2008 R4 Service Pack 4 Feature Packs "SQLSysClrTypes.msi" to have the Microsoft.SqlServer.Types.dll up to date.

However, it is still not working and the same error occurs.

Any idea that can help me? Is it supported?

Thanks in advance!

David BP
  • 21
  • 3

0 Answers0