0

I know how to get Dynamic Linq to project sub (non-collection) objects, e.g.

"new(new(CustomerStat.ID) as CustomerStat)", where CustomerStat is a non-collection object.

I'd like to do the something similar with collections, e.g. "new(LocationId, new(Employees.Select(FirstName)) as Employees)", which would return a projected list of locations, with sublists of employees, containing just their first name.

Or in other words, I'd like the DynamicLinq version of the following:

  var locations = (new CompanyContext().Locations.
    Select(l => new {l.ID, Emps = l.Employees.Select(e=>e.FirstName)}));

Thanks!

Pranay Rana
  • 175,020
  • 35
  • 237
  • 263
Giovanni Galbo
  • 12,963
  • 13
  • 59
  • 78

1 Answers1

0

We ended up having to modify DynamicLinq to support this feature.

We've made a pull request with the new feature. Code can be found here.

Giovanni Galbo
  • 12,963
  • 13
  • 59
  • 78