I have linQ query like the one below
 var records = (from P in Person
                join B in BankAccount
                on P.ID equals B.PersonID
                select new { P, B}).ToList();
The person table has a lot of fields but I need to only work with ID & Name. Similarly for BankAccount I only need to work with ID, AccountType and AccountBalance
I then pass the records var type as above to another mapper class with a method like so
    public List<CompositeDTO> MapToDto(IEnumerable<object> data)
    {
        foreach (var rec in data) 
        {
         dto.InjectFrom(rec );
         dtoList.Add(dto);
        }
        return dtoList;
    }
Where CompositeDTO is as below
public class CompositeDTO 
{
  public int PersonID {get; set;}
  public String PersonName {get; set;}
  public int AccountID {get; set;}
  public String AccountType{get; set;}
  public int AccountBalance{get; set;}
}
The problem is I am not able to get any values into my object of type CompositeDTO using dto.InjectFrom(rec ) 
How should this be done? The documentation here only explained how to do it for one field from two different source classes. Have I missed something ? Can this be done?
 
     
     
     
    