title: ForAllMembers, Map based on condition
body: <p>Need to conditionally map properties based on if they appear in the <code>InvalidProperties</code> list.  If the current source property name exists in the list, then it should use the destinations value.</p>
  
  <p>Created a solution, but not sure if it's the "right way" to do it:</p>
  
  <pre><code>     public class MyBassClass
        {
          public List&lt;string&gt; InvalidProperties
          {
            get;
            set;
          }
        }
  
    public class PersonAllergy : MyBassClass
    {
      public PersonAllergy()
      {
        InvalidProperties = new List&lt;string&gt;();
      }
      public int Id
      {
        get;
        set;
      }
      public string Allergy
      {
        get;
        set;
      }
    }
    public class Person : MyBassClass
    {
      public Person()
      {
        InvalidProperties = new List&lt;string&gt;();
        Allergy = new PersonAllergy();
      }
  
          public PersonAllergy Allergy
          {
            get;
            set;
          }
          public string FirstName
          {
            get;
            set;
          }
          public string LastName
          {
            get;
            set;
          }
          public int Age
          {
            get;
            set;
          }
        }
  
      private static bool IgnoreInvalid( AutoMapper.ResolutionContext context )
      {     
        return ( (MyBassClass)context.InstanceCache.First().Value )
          .InvalidProperties.Contains( context.MemberName );    
      }
  </code></pre>
  
  <p>Usage:</p>
  
  <pre><code>  Person person = new Person();
    person.FirstName = "john";
    person.LastName = "smith";
    person.Age = 45;
    person.Allergy.Id = 1;
    person.Allergy.Allergy = "Penacilin";
    person.Allergy.InvalidProperties.Add( "Id" );
    person.InvalidProperties.Add( "Age" );
    Person templatePerson = new Person();
    templatePerson.FirstName = "sam";
    templatePerson.LastName = "rottenburg";
    templatePerson.Age = 55;
    templatePerson.Allergy.Id = 2;
    templatePerson.Allergy.Allergy = "Monkeys";
  
    AutoMapper.Mapper.CreateMap&lt;Person, Person&gt;()
      .ForAllMembers( opt =&gt; opt.Condition( IgnoreInvalid ) );
    AutoMapper.Mapper.CreateMap&lt;PersonAllergy, PersonAllergy&gt;()
      .ForAllMembers( opt =&gt; opt.Condition( IgnoreInvalid ) );
    var mergedPerson = AutoMapper.Mapper
      .Map&lt;Person, Person&gt;(templatePerson, person);
    mergedPerson.Allergy = AutoMapper.Mapper
      .Map&lt;PersonAllergy, PersonAllergy&gt;( templatePerson.Allergy, person.Allergy );
  </code></pre>
  
  <p>Person Outputs:</p>
  
  <ul>
  <li>Age: 45 (instead of 55) </li>
  <li>FirstName: John </li>
  <li>LastName: Smith</li>
  </ul>
  
  <p>Allergy Outputs:</p>
  
  <ul>
  <li>Allergy: Penacillin</li>
  <li>Id: 2 (instead of 1)</li>
  </ul>