dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.73k stars 3.18k forks source link

UseNetTopologySuite extension for InMemory database #19306

Closed Hameds closed 2 years ago

Hameds commented 4 years ago

I used 'InMemory' in my unit tests and I have some spatial data. According to docs there is builtin support for UseNetTopologySuite() extension method in SQL Server and Sqlite. There is also support for this extension method in PostgreSQL using https://github.com/npgsql/efcore.pg but no support for InMemory.

If you look at EF source code you can see EFCore.Sqlite.NTS and EFCore.SqlServer.NTS projects. It's nice to have EFCore.InMemory.NTS project.

smitpatel commented 4 years ago

Since InMemory is "in-memory" there is no need to provide translation or mapping to store type. It just works because NTS is loaded in memory already. You don't need to call anything specific. NTS works for in-memory out of the box.

Hameds commented 4 years ago

@smitpatel thanks for the comment. I tried to seed InMemory in my unit tests with a Point (from NetTopologySuite.Geometries namespace) but it didn't work. I assumed it's related to UseNetTopologySuite() extension method. I will check again.