是否可以投影对象的每个属性并添加更多内容,而无需专门列出所有属性.例如,而不是这样做:
var projection = from e in context.entities select new QuestionnaireVersionExtended { Id = e.Id,Version = e.Version,CreationDate = e.CreationDate,... many more properties ... NumberOfItems = (e.Children.Count()) };
我们可以做这样的事情:
var projection = from e in context.entities select new QuestionnaireVersionExtended { e,NumberOfItems = (e.Children.Count()) };