Git Product home page Git Product logo

Comments (5)

latonz avatar latonz commented on August 20, 2024

Couldn't this be addressed with #513?

from mapperly.

mpickers avatar mpickers commented on August 20, 2024

@latonz Yes, that seems like it's the option 2 I described above.

That would do the trick!

from mapperly.

mpickers avatar mpickers commented on August 20, 2024

@latonz With getting to know Mapperly a bit better, and seeing that the current behavior is:

  1. You define a "main" map eg
    public static partial MyClassDto ToMyClassDto(this MyClass o);
  2. You define derivations of the main map and Mapperly will automatically use the rules of the "main" map eg
    public static partial List<MyClassDto> MapToList(this List<MyClass> o);
    public static partial IQueryable<MyClassDto> ProjectTo(this IQueryable<MyClass> o);

I'd perhaps suggest that for consistency a ToExistingDto() type mapping should also fall under this same sort of behavior. ie no attribute needed and Mapperly will automatically use the rules of the "main" map.

from mapperly.

latonz avatar latonz commented on August 20, 2024

When needing a mapping from one type to another Mapperly always uses the default mapping. For your list and queryable examples this will happen as you described as Mapperly needs a mapping from MyClass to MyClassDto down the object tree. However, a ToExistingDto mapping is a new root-level alternative mapping to the default mapping and often the user wants a different configuration for it, therefore I don't think automatically applying the same configuration is a good idea. It would also make the API less explicit and harder to debug.

from mapperly.

latonz avatar latonz commented on August 20, 2024

Closing in favor of #513.

from mapperly.

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.