我尝试使用下面的LINQ查询来映射带有ValueInjecter的对象列表:
var thingsCollection = rep.Things.Select(x => new ThingDTO().InjectFrom(x) as ThingDTO)
.OrderByDescending(x => x.StartDate).ToList();问题是,这个东西和ThingDTO对象包含了其他的对象:
public class ThingDTO
{
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public MaterialDTO Material{ get; set; }
}我应该使用什么样的注入方法来获得子对象映射?还是我必须做一个预测,而不是LINQ查询?
发布于 2013-07-26 08:30:40
对于每个需要手动实例化集合并添加新映射元素的新映射对象,您都必须手动执行此操作。
https://stackoverflow.com/questions/17834369
复制相似问题