Giter Site home page Giter Site logo

Comments (6)

cezarypiatek avatar cezarypiatek commented on May 22, 2024

I would like to keep mapping rules quite obvious and "detect slight variation in property name" could result in complicated logic and the outcome could be far away from expected for different use cases. The second option with not overriding entire method requires add some merging logic. I was thinking about adding option to assign default value for unmapped target fields which could help to spot places with naming discrepancy or missing fields. For now to avoid complete method overriding you can write line with assigning source to destination

public override void Convert(T1 source, T2 destination)
{
    destination = source;
}

and try to apply another code fix which comes with MaggingGenerator that create conversion (the bulb should appear in line with the assignment).

image

from mappinggenerator.

OmiCron07 avatar OmiCron07 commented on May 22, 2024

Ok, but the problem is maintainability. No way you generate the mapping once and never change it. Some properties will be added, some will be removed.

I can't imagine having to remove the code, writing target = source,, alt-enter, Generate, each time to update the mapping.

I know the problem is not trivial, but I need a tool to quickly generate mapping code and also, update the mapping efficiently.

What do you think?

from mappinggenerator.

cezarypiatek avatar cezarypiatek commented on May 22, 2024

I don't see the problem with maintainability. In most cases you add or remove single field, so it's not big effort to apply this simple modification manually instead of regenerating the whole mapping. What if in the meantime somebody add custom, non-trivial mapping logic? How am I supposed to detect that and perform merging during regeneration? How to decide if this modification is still valid and should survive the regeneration?

from mappinggenerator.

OmiCron07 avatar OmiCron07 commented on May 22, 2024

If the target or source property is already used, skip it?

from mappinggenerator.

cezarypiatek avatar cezarypiatek commented on May 22, 2024

sounds simple, and if the method flow is simple (no conditional or loop statements) it could work. Anyway I think it should be registered as separated code fix - with the update purpose.

from mappinggenerator.

cezarypiatek avatar cezarypiatek commented on May 22, 2024

I'm not going to implement a synchronization mechanism. If you need a mapping code that is continuously synchronized with models, please take a look at OnBuild plugin (#79) that generates mapping code during the build.

from mappinggenerator.

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.