Git Product home page Git Product logo

Comments (5)

jenschude avatar jenschude commented on June 22, 2024 1

Just opened a PR which adds the API specific marker interfaces. For backwards compatibility the registration of the SerializerService classes are still there, but internally it will be only retrieved by it's interface.

So it should be possible to mock or replace them e.g. in tests.

We need the marker interfaces as the serialization configuration can be a little bit different and even conflicting between the APIs.

from commercetools-dotnet-core-sdk-v2.

jenschude avatar jenschude commented on June 22, 2024 1

Yes. That's the idea behind it. And for testing purposes you could inject whatever implementation you mark with the interface ;)

from commercetools-dotnet-core-sdk-v2.

jenschude avatar jenschude commented on June 22, 2024

We would more likely have to create a marker interface for each of the SerializerService implementations, as they hold specific configurations for the supported API.

But overall yes we are open for supporting a interface instead of a specific implementation

from commercetools-dotnet-core-sdk-v2.

MoritzDa avatar MoritzDa commented on June 22, 2024

Okay I must say that I don't fully understand the purpose of a marker interface and how and where it is used. But I trust, that you guys know the potential benefits of using it.
So do you think my sugestet idea is any good? Or do you think it should be implemented differently, with the mentioned marker interface? Or not implemented at all?

from commercetools-dotnet-core-sdk-v2.

MoritzDa avatar MoritzDa commented on June 22, 2024

Hey, perfect! Thank you for the fast implementation. Really appreciate it.

I now understand better what you meant by the marker interfaces. After seeing your changes and implementation.

Just for my understanding:
I now can just use in the DI setup: (when the new version is released)

...
services.UseCommercetoolsApiSerialization();
...

And the use the marker interface in the constructor for example like this:

    private readonly IApiSerializerService _serializerService;

    public ExampleService(IApiSerializerService serializerService)
    {
        _serializerService = serializerService;
    }

Thank you a lot again :)

from commercetools-dotnet-core-sdk-v2.

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.