Comments (4)
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:
- 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).
- 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.
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.
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:
- 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).
- 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):
- 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 - 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.
With GeoAPI
merged into NetTopologySuite there is no reason to have two public instances of IGeometryServices
.
from geoapi.
Related Issues (20)
- Get permissions from all contributors (at least all who have made significant changes) to agree to license change. HOT 6
- Relicense GeoAPI.Core under BSD3 HOT 1
- Should ILineString include Count? HOT 5
- GeoAPI 1.7.4 to 1.7.5 broke come code HOT 13
- Is the GeoAPI 1.7.5 Nuget package missing dll's? HOT 1
- It looks like GeoAPI.Geometries.IGeometry.Intersection doesn't carry over data in the UserData property. HOT 4
- Remove obsolete interfaces, classes and members HOT 1
- Future of Coordinate class HOT 1
- [question] Typescript definition for geoapi HOT 1
- CoordinateXY.CompareTo(object) is incorrect HOT 3
- Remove ICloneable implementations across the board
- Target just .NET Standard 2.0
- Remove reflection-based GeometryServiceProvider.Instance bootstrap HOT 1
- Remove redundant interface members HOT 2
- Replace notable interfaces with abstract classes, for multiple reasons HOT 8
- Reconsider use of SerializableAttribute HOT 2
- Remove (standalone) GeoAPI HOT 13
- support .NET core 3.0 HOT 2
- Serialization BUG
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoapi.