AutoMapper/AutoMapper — pull request #590 by TylerCarlson1 (2014-09-15 05:19:37+00:00)
Title: Include with conditions on source type

Addresses issue #258

Added IncludeOnSourceType function which will map to destination if source condition is met.

Had to do a lot of internal re-factoring in multiple commits to show an underlying problem with how includes were handled, and then add the ability to specify conditions, default before which was did the types inherit, and now condition from the source to determine how to map to the destination.

Before it wasn't using the includedDeriveTypes as part of the possible included mappings, only whether one existed or not. Ergo it assumed that if there were included types it would include them all.
So now it's going on the condition that type map must match types of included TypePair, as well as meet its condition to say the type map is applicable to be mapped over.

This pull request might need a few changes. Better name for the new Include function call, internal re-ordering of include functionality, ect... But this will allow #258 to be possible, along with others to make their own extensions off the Include(type, type, condition) for whatever scenario they might want, not just checking source and destination types.