title: How to MapFrom a collection? Auto mapper
body: <p>I have a linq to sql object that has some references to some other tables</p>
  
  <p>I am trying to map it to a vm but nothing ever gets captures.</p>
  
  <pre><code>Mapper.CreateMap&lt;A, G&gt;();
  
  
  // A is the linq to sql object
  A.MyList // this is a collection that I am trying to get the value out of A.MyList.Id
  
  // G is my View Model
  public class G
  {
     public string AMyListId {get; set;}
  
  }
  
  
   vm = Mapper.Map&lt;List&lt;A&gt;, List&lt;G&gt;&gt;(aListOfAFromDb);
  </code></pre>
  
  <p>This always comes back from null. I thought I would have to do it manually so I tried</p>
  
  <p><code>Mapper.CreateMap&lt;A, G&gt;().ForMember(dest =&gt; dest.AMyList , opt =&gt; opt.MapFrom(src =&gt;????))</code>;</p>
  
  <p>but since I am getting it from a list it won't give any of the properties to choose from.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I realized that I should not have a list of "MyList" it should be a one to one. I still am having problems trying to do what I want to do.</p>
  
  <p>I have this</p>
  
  <p>Mapper.CreateMap();</p>
  
  <pre><code>A.Vip.UserId // again my linq object is A
  
  // G is my View Model
  public class G
  {
     public string IsVip {get; set;}
  
  }
  
  
   vm = Mapper.Map&lt;List&lt;A&gt;, List&lt;G&gt;&gt;(aListOfAFromDb);
  
   Mapper.CreateMap&lt;A, G&gt;().ForMember(dest =&gt; dest.IsVip, opt =&gt; opt.AddFormatter&lt;VipFormatter&gt;());
  
  
  public class VipFormatter : IValueFormatter
      {
          public string FormatValue(ResolutionContext context)
          {
              bool value = (bool)context.SourceValue;
  
              if (value)
              {
                  return "Yes";
              }
  
  
              return "No";
  
          }
      }
  </code></pre>
  
  <p>yet nothing every gets bound. I am not sure why. Do I have to do change my property to "AVipUserId"? Or somehow tell it to map?</p>