views:

17

answers:

1

Is there any way to validate mappings at compile time? For example, I have an entity with many child entities. If I forgot to add a CreateMap for one of the childen when I try to map ParentX to ParentY the mapping will fail.

I can't think of a way to validate this during compile but I'd love to find a way.

+1  A: 

No, there's not a clean way to do so. You could try a post-build hook to call a unit test, but that's not much different than actually executing a unit test. In our experience, we just keep the AutoMapper configuration unit test open while we build our ViewModels, verifying as we go.

Jimmy Bogard