Skip to content

ParseException when using composite key for grouping in GroupByMany #945

@BlackPuddingERP

Description

@BlackPuddingERP

When using GroupByMany with a string-based selector that builds a composite key, System.Linq.Dynamic.Core throws “No property or field 'xxxxx' exists in type 'Object'”, while the strongly-typed lambda overload works.

Example to Reproduce

var data = new[] {
new { MachineId = 1, Machine = new { Id=1, Name="A"} },
new { MachineId = 1, Machine = new { Id=1, Name="A"} },
new { MachineId = 2, Machine = new { Id=2, Name="B"} }};

// This doesn't work
data.GroupByMany("new (MachineId, Machine.Name)", "Machine.Id");

// This works
data.GroupByMany(a => new { a.MachineId, a.Machine.Name }, a => new { a.Machine.Id });

I hope the example is helpful, thank you.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions