Disable Auto Mapping #1042
Replies: 3 comments
-
Sorry to hear about your frustration. 😞
Would it be possible for you to share your mapper/ an example of your issue. I can't think of why Mapperly would attempt to map every type in your assembly 🤔 |
Beta Was this translation helpful? Give feedback.
-
Converted this to a discussion as currently it is not really clear what the issue is. Waiting on a minimal repro and more information. |
Beta Was this translation helpful? Give feedback.
-
Closing as no further information was provided. Feel free to reopen with additional info. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I'm extremely frustrated. After spending an hour trying to figure out why I cannot use mapperly out the box, I just realized it is because it is generating mapping for all classes in my connected assembly. The mapping is causing a build failure because the mapping it is automatically generating is not supposed to happen. I only have 1 Mapper partial class setup so that I could test mapperly and then continue my mapping setup. I have done no other configurations, but looking at the generated mapping, mapperly is mapping everything in the project and the referenced assembly.
Describe the solution you'd like
There should be a setting/configuration to apply a global stop to "auto mapping/auto detecting" classes that have not been explicitly configured for mapping. I should not have to install mapperly on an assembly not meant to have mapping so that I can decorate it to prevent auto mapping.
Describe alternatives you've considered
At the moment I cannot think of an alternative. I've been trying to think of a clean solution to the issue for about half hour. The only alternative I can think of is to use another mapper or map manually.
Additional context
The connected assembly has 2 classes, a master and detail if you will. The assembly containing the mapping has 1 class which should consume both the external classes. I can successfully create the mapping I need, but when I move the properties to the new class constructor, the auto generated mapping I do not want & have no need for fails "There is no argument given that corresponds to the required parameter x of MyClass(int, int)". The target class looks like so:
public record MyClass(int id, int param2);
Beta Was this translation helpful? Give feedback.
All reactions