Comments (5)
How do you suggest doing this given how XmlSerializer
works?
I agree that the dependency on Sytem.Xml
is not ideal.
from mathnet-spatial.
I would move the responsibility of XML serialization into a set of data transfer objects (DTOs) and use a mapping layer to convert between the core types and the DTOs. This pattern could then be used to add JSON serialization similarly.
Then a developer could add serialization support to their project through Nuget by installing MathNet.Spatial.Serialization.Xml, for example. Units.Net does something similar.
from mathnet-spatial.
I can move support for serialization from the system.runtime.serialization (DataContracts etc) into a separate (.netstandard2.0 - possibly 1.6) assembly (and at the same time improve serialization support). This is fairly straight forward and works well and as you say should extend to being able to support json too.
However, with regards to the native XmlSerializer even with DTOs the use experience is not great as you cannot (at least as far as I can find) intercept the type lookup for nested types. This would mean converting a type tree into a surrogate type tree before serializing and back again after deserialization. This would only work if you were serializing the objects as standalone objects but would fail in the case you embedded a geometry type into your own serializable class. Not really an ideal experience.
An option would be to drop support for XmlSerializer and either just support data contracts or also support a 3rd party xml serializing solution like ExtendedXmlSerializer in order to be able to keep existing format compatibility for people who have saved representations of the current types.
Another thing to keep in mind is that the current xml serialization support is incomplete with not all types in the library supporting serialization, so either way there is something to be addressed here.
from mathnet-spatial.
How big problem is the dependency on System.Xml
?
I agree it is not nice but can be convenient.
Next question is how big is the upside?, I don't know if XmlSerializer
is used much.
@AQuentin2033 Agreed we should have all types implement IXmlSerializable
if we have the dependency.
from mathnet-spatial.
Not that it matters much for anything but nodatime does things the same way we do.
from mathnet-spatial.
Related Issues (20)
- No 1D line segment support HOT 3
- Plane created from three points returns different result for Equals depending on the order of the points HOT 5
- Readme's Docs link broken
- LineSegment3D.TryShortestLineTo throws when segments intersect HOT 1
- Circle2D.FromPoints gives incorrect results for special cases.
- LineSegment2D - TryIntersect - should this return the intersection of lines or line segments? HOT 3
- Rotation(yaw, pitch, roll) uses extrinsic rotations
- Support for Matrix4D HOT 1
- Suggestion: Plane.TryFromPoints() HOT 3
- Checking for equal input points in Plane.FromPoints() is redundant? HOT 2
- I would like to contribute to the project HOT 5
- Website copyright date is not current
- Vector2D.SignedAngleTo returns bad angle result (fix described)
- Cross product error checks are different depending on whether you pass it a UnitVector3D or a Vector3D HOT 3
- CoordinateSystem: System.TypeInitializationException HOT 1
- Question: still active?
- The API on the official website is down
- Version 0.7.0 not available on Nuget HOT 7
- Why let the X, Y, Z readonly? HOT 2
- MathNet.Spatial.Euclidean.Line3D retruns UnExpected NULL HOT 5
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 mathnet-spatial.