I try to map a list of objects with ValueInjecter using a LINQ query like this :
var thingsCollection = rep.Things.Select(x => new ThingDTO().InjectFrom(x) as ThingDTO)
.OrderByDescending(x => x.StartDate).ToList();
The problem is that the Thing and the ThingDTO objects contain other objets :
public class ThingDTO
{
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public MaterialDTO Material{ get; set; }
}
What kind of injection method should I use to get the sub object map ? Or do I have to do a foreach instead of the LINQ query ?
you would have to do it manually for each new mapped object you need to instantiate the collection manually and add the new mapped elements