title: Automapper mapping to multiple foreign keys
body: <p>I am using a paged list which has details of a user. All the details come from the User table except the role which I get ID from the UserRole table which I use it to get Roles from the role table. There is a chance of one user having multiple roles. So basically the UserRole table has UserID and RoleID as foreign keys which connect the User and Role table.</p>
  
  <p>So the code that I have is </p>
  
  <pre><code>config = new MapperConfiguration(cfg =&gt;
                  {
                      cfg.CreateMap&lt;User, UserViewModel&gt;().ForMember(m =&gt; m.RolesList, opt =&gt; opt.MapFrom(source =&gt; (source.UserRoles.Select(w=&gt;w.Role.Name).ToList())));
                  });
  </code></pre>
  
  <p>The RolesList is an IEnumerable.</p>
  
  <p>How do i go about in this case of multiple foreign keys?</p>
  
  <p>EDIT: The modified code now gives the role but in case of a user with multiple roles, It still gives me only one role. Is there a way I can get all the roles for a particular user?   </p>