I am trying to map a collection of EntityFramework objects to 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 list of reports is not displayed. What am I doing wrong?
IList<ChannelListViewModel> viewModelList = channelList.Select(x => new ChannelListViewModel().InjectFrom(x)).Cast<ChannelListViewModel>().ToList();
source share