Closed JasonBock closed 3 years ago
I'm thinking of also creating some diagnostics to tell people if there are duplicates. For example, if I had this:
[MapTo(typeof(Destination))]
public class Source { ... }
[MapFrom(typeof(Source))]
public class Destination { ... }
[assembly: Map(typeof(Source), typeof(Destination))]
Only one of them is needed. The last two that I find, I'd flag as a warning (or maybe info). They're not breaking anything, just not necessary.
It's possible that the developer doesn't have access to the source code for the source and/or destination types. Therefore, let's create two new attributes,
MapFromAttribute
andMapAttribute
.MapFromAttribute
would be used if the destination type is editable, but not the source:If both the source and destination types are not editable,
MapAttribute
would be used:Note that this has to happen as the assembly level.
In both cases, the extension method would still be created for the source type.