I'm trying to map a collection of EntityFramework objects with a collection of view models.
public class Channel
{
public Guid Id { get; set; }
public string Name { get; set; }
public IEnumerable<Report> Reports { get; set; }
}
public class ChannelListViewModel
{
public Guid Id { get; set; }
public string Name { get; set; }
public IEnumerable<Report> Reports { get; set; }
}
Using the code below the Reports list is not being mapped. What am I doing wrong?
IList<ChannelListViewModel> viewModelList = channelList.Select(x => new ChannelListViewModel().InjectFrom(x)).Cast<ChannelListViewModel>().ToList();