You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.
I know that this issue is a little out of the scope of this project. I've seen #131.
I wanted to change AutoMapper to MappingGenerator but I have one blocker. I have many profiles in my program (the same situation is in many other projects in my company) and I have one unit test that checks the validation of mapping
foreach(var profile in profiles){varmapperConfig=new MapperConfiguration(cfg =>{ cfg.AddProfile(profile);});try{
mapperConfig.AssertConfigurationIsValid();}catch(AutoMapperConfigurationExceptionex){// I know that there is a problem}}
If someone adds a property to an object, the test will show him an error. I can't reproduce this behavior with MappingGenerator without creating a unit test for each mapping. But it requires a lot of work and the reviewer have to check if the test is added.
So if I have junior devs in my team I prefer to stay with AutoMapper with its disadvantages (I know it is slow, it is hard to debug, IDE doesn't show references of property) but I know that mappings are ok (or it is highly probable)
Any ideas on how to automate it?
The text was updated successfully, but these errors were encountered:
I'm not familiar with the profiles (or I don't remember it, because it's been round 6 years since I used AutoMapper the last time). If you want to track unmapped fields then I would recommend trying to use /*FullInitRequired:recursive*/ marker with my other analyzer described here https://cezarypiatek.github.io/post/immutable-types-with-roslyn/ This should solve the problem at least from the target object perspective.
I know that this issue is a little out of the scope of this project. I've seen #131.
I wanted to change
AutoMapper
toMappingGenerator
but I have one blocker. I have many profiles in my program (the same situation is in many other projects in my company) and I have one unit test that checks the validation of mappingIf someone adds a property to an object, the test will show him an error. I can't reproduce this behavior with
MappingGenerator
without creating a unit test for each mapping. But it requires a lot of work and the reviewer have to check if the test is added.So if I have junior devs in my team I prefer to stay with
AutoMapper
with its disadvantages (I know it is slow, it is hard to debug, IDE doesn't show references of property) but I know that mappings are ok (or it is highly probable)Any ideas on how to automate it?
The text was updated successfully, but these errors were encountered: