title: Automapper resolve destination type based on the value of an enum in source type
body: <p>I'm trying to find a way for Automapper to pick the destination type of a call to map, based on an Enum value set in the Source type...</p>
  
  <p>e.g. Given the following classes:</p>
  
  <pre><code>public class Organisation
  { 
      public string Name {get;set;}
      public List&lt;Metric&gt; Metrics {get;set;}
  }
  
  public class Metric
  {
     public int NumericValue {get;set;}
     public string TextValue {get;set;}
     public MetricType MetricType {get;set;}
  }
  
  public enum MetricType
  {
      NumericMetric,
      TextMetric
  }
  </code></pre>
  
  <p>If I have the following object:</p>
  
  <pre><code>var Org = new Organisation { 
      Name = "MyOrganisation",
      Metrics = new List&lt;Metric&gt;{
          new Metric { Type=MetricType.TextMetric, TextValue = "Very Good!" },
          new Metric { Type=MetricType.NumericMetric, NumericValue = 10 }
      }
  }
  </code></pre>
  
  <p>Now, I want to map this to to a viewmodel representation of it which has the classes:</p>
  
  <pre><code>public class OrganisationViewModel
  { 
      public string Name {get;set;}
      public List&lt;IMetricViewModels&gt; Metrics {get;set;}
  }
  
  public NumericMetric : IMetricViewModels
  {
      public int Value {get;set;}
  }
  
  public TextMetric : IMetricViewModels
  {
      public string Value {get;set;}
  }
  </code></pre>
  
  <p>The call to AutoMapper.Map will result in an  OrganisationViewModel containing one NumericMetric and one TextMetric. </p>
  
  <p>The Automapper call:</p>
  
  <pre><code>var vm = Automapper.Map&lt;Organisation, OrganisationViewModel&gt;(Org);
  </code></pre>
  
  <p>How would I go about Configuring Automapper to support this? Is this possible? (I hope this question is clear)</p>
  
  <p>Thanks! </p>