Suppose we have two c# classes A and B with the following properties
A
-Name
-SurName
B
-Name
-SurName
Using Automapper I can map from class A to class B without any problem.
What happened if I do a refactor to Class A -Name. Using VS2010 Rename.
Then Classes would be
A
-NameRefactored
-SurName
B
-Name
-SurName
Due to the fact we are using Automapper the Refactor has no way to know that he should also change the name of B.
Worst the refactor will never complain anything until We found that the B.Name after the AutoMap is empty....
How can we avoid this kind of problems?
Use the Mapper.AssertConfigurationIsValid() method to verify your configuration. It does exactly as advertised - checks to make sure that all members on the destination types are mapped.