我正在尝试将 EntityFramework 对象的集合与视图模型的集合进行映射。
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; }
}
使用报告列表下方的代码未映射。我究竟做错了什么?
IList<ChannelListViewModel> viewModelList = channelList.Select(x => new ChannelListViewModel().InjectFrom(x)).Cast<ChannelListViewModel>().ToList();