Oracle Sdo_Geometry with EF Core #671
Unanswered
CalciferZero
asked this question in
Q&A
Replies: 1 comment
-
You'll need to follow up with the ODP.NET team to see if they have any plans to add spatial support to their EF Core provider. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a project with .Net 5.0 and Oracle is the databse provider. The versions of the packages I'm using are:
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.10" /> <PackageReference Include="NetTopologySuite.IO.Oracle" Version="3.0.0" /> <PackageReference Include="Oracle.EntityFrameworkCore" Version="5.21.3" />
I would like to configure the DbContext, and the 'AddDbContext' to accept the use of topology, so using fluent API I could create a migration with a geometry column, like this:
builder.Property(p => p.WKTSRID) .HasColumnType("SDO_GEOMETRY") .HasConversion(w => WKTToSdoGeometry(w.WKT, w.SRID), r => SdoGeometryToWKT(r))
Now, when I create a migration I get the following error:
Is there any way to achieve this? If not, can you give any hint to add the missing support?
Edited:
I've also tested directly with a NetTopologySuite.IO.Sdo.SdoGeometry property. Having my entity class like this:
public class MyGeo { public SdoGeometry MySdoGeo { get; set; } }
And my EF configuration as either of this two:
builder.Property(p => p.MySdoGeo) .HasColumnType("SDO_GEOMETRY")
builder.Property(p => p.MySdoGeo)
I obtain the same error:
I've also tried using the type 'NetTopologySuite.Geometries.Geometry' and setting the property type and the conversion on the EF configuration as follows, but doesn't work:
public class MyGeo { public Geometry MySdoGeo { get; set; } }
builder.Property(p => p.MySdoGeo) .HasColumnType("SDO_GEOMETRY") .HasConversion(a => Geo2SdoGeometry(a), d => SdoGeometry2Geo(d))
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions