cezarypiatek / MappingGenerator

:arrows_counterclockwise: "AutoMapper" like, Roslyn based, code fix provider that allows to generate mapping code in design time.
https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator
MIT License
1.03k stars 119 forks source link

Allow different spellings for comparison #145

Closed Matt-17 closed 3 years ago

Matt-17 commented 3 years ago

Sometimes I'm missing some mappings for different spelled properties. For example I have in my EF6 DB context something like: some_special_ID and in my own class SomeSpecialId it does not match them. Here could be a broader search done (case insensitive and removed _).

Edit - this part is duplicate: Also it would be great, if I could choose non-compilable mappings for missing properties like

Property1 = TODO, TODO = Property2

Here I would immediatly see, there is something missing (in cases I need this addin, I have 50 Properties and more, not so easy to notice, something is missing.

Thank you and great add in. :-)

cezarypiatek commented 3 years ago

Hi @Matt-17

Ad1. I can extend MappingGenerator to handle the case with case sensivity as well as with underscores. Ad2, Feature with comments for unmapped fields can be tracked here https://github.com/cezarypiatek/MappingGenerator/issues/7

In the meantime please consider supporting MappingGenerator project

cezarypiatek commented 3 years ago

@Matt-17 Here's a pre-release version that contains requested feature. Would you mind testing it and letting me know if it works as you expected?

VSIX: https://ci.appveyor.com/api/buildjobs/tgci2cl29la6vucj/artifacts/MappingGenerator%2FMappingGenerator%2FMappingGenerator.Vsix%2Fbin%2FRelease%2FMappingGenerator.vsix

Nuget: https://ci.appveyor.com/api/buildjobs/tgci2cl29la6vucj/artifacts/MappingGenerator%2FMappingGenerator%2FMappingGenerator%2Fbin%2FRelease%2FMappingGenerator.1.19.458.nupkg

Matt-17 commented 3 years ago

@cezarypiatek Thank you for the fast improvement. This works as far as I mentioned it. So great work an consider this as closed so far. :-)

Only thing I saw, but is probably a new issue are cases like "Enabled" vs "IsEnabled", "Type" vs "Catalog_Type" or even very special cases in Germany with "a" vs "ae" vs "ä" you cannot handle all of them.

Anyway, for most database mappings this is a great improvement now. Thank you!

cezarypiatek commented 3 years ago

Can you provide a sample mapping code that illustrate all the cases that you mentioned?

Matt-17 commented 3 years ago

Yes, I try to figure out a bunch of samples. But as mentioned, this is much further than just ignoring uppercase and snake_case. So I suggest, this issue is closed by now and I think about it further (also how it could be solved, since this is definitely not desired behaviour by everybody).

cezarypiatek commented 3 years ago

An official version 1.20.463 with this feature has been released