Giter VIP home page Giter VIP logo

Comments (4)

roji avatar roji commented on June 17, 2024 1

Just to add a few more comments, continuing the discussion with @bricelam cited above...

I think it may make sense to retain GeometryServiceProvider.Instance. As written above, the Npgsql ADO provider (not the EF Core provider) has no dependency injection of any sort. Now, I think the following are reasonable requirements from the Npgsql NTS plugin:

  1. If the user hasn't indicated they're interested in any specific GeoAPI implementation, the plugin should default to using NetTopologySuite (i.e. instantiate NTS objects when reading PostGIS data from the database).
  2. However, the plugin should definitely support other GeoAPI implementations. This could be done by:
    a. Receiving a GeometryServiceProvider instance in the plugin's initialization, or
    b. A global static setting as it is now (GeometryServiceProvider.Instance)

While I agree that responsibilities around setting GeometryServiceProvider.Instance can be a bit confusing, it does seem to make sense to allow end users to specify the desired GeoAPI implementation globally once, at the start of the application, and have it picked up by various libraries (e.g. ORMs). However, these libraries should probably also optionally allow a GeometryServiceProvider instance to be passed in, just in case the global setting isn't sufficient.

I may have missed some issues/complexities that GeometryServiceProvider.Instance creates, though...

from geoapi.

bricelam avatar bricelam commented on June 17, 2024

Copying some comments here.

@bricelam said:

We never go through GeoAPI.GeometryServiceProvider.Instance so [calling NetTopologySuiteBootstrapper.Bootstrap() is] not needed. Instead, we register NtsGeometryServices.Instance (as IGeometryServices) in the service provider and pass it into the NTS Reader.

This provides much more flexibility than the GeometryServiceProvider.Instance service locator anti-pattern since you can use different services with different DbContext instances.

@roji said:

I think this is where the SqlServer/Sqlite spatial implementation may actually have an advantage over Npgsql's.

With Npgsql, NTS is supported at the ADO level - which is great because you can easily use it without EF Core. However, unlike with EF Core there's no fancy dependency injection in ADO, so at least at the moment everything is done with the global NTS bootstrapping, which as you say isn't ideal.

from geoapi.

airbreather avatar airbreather commented on June 17, 2024

I think it may make sense to retain GeometryServiceProvider.Instance. As written above, the Npgsql ADO provider (not the EF Core provider) has no dependency injection of any sort. Now, I think the following are reasonable requirements from the Npgsql NTS plugin:

  1. If the user hasn't indicated they're interested in any specific GeoAPI implementation, the plugin should default to using NetTopologySuite (i.e. instantiate NTS objects when reading PostGIS data from the database).
  2. However, the plugin should definitely support other GeoAPI implementations. This could be done by:
    a. Receiving a GeometryServiceProvider instance in the plugin's initialization, or
    b. A global static setting as it is now (GeometryServiceProvider.Instance)

The idea behind this one is that I expect everybody who currently uses GeometryServiceProvider.Instance to fall into at least one of two categories (probably often both):

  1. They would be better off using an implementation of IoC that's already available in their context to get the IGeometryServices instead (this is what @bricelam was referring to), and/or
  2. They can just as easily switch to using NtsGeometryServices.Instance instead.

With #70, the case is even easier to make because the two types are going to be right next to each other.

from geoapi.

FObermaier avatar FObermaier commented on June 17, 2024

With GeoAPI merged into NetTopologySuite there is no reason to have two public instances of IGeometryServices.

from geoapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.