I feel like I am missing something simple, but I have not found the documentation that answers my question.
I have recently been decomposing some of the linq projection
You can use LINQKit to expand the expressions that you have within other expressions:
private static Expression> CreateDepartmentDtoUnexpanded = d => new DepartmentDto
{
Manager = CreatePersonDto.Invoke(d.Manager),
Employees = d.Employees.Select(employee => CreatePersonDto.Invoke(employee))
.ToList(),
};
public static Expression> CreateDepartmentDto = CreateDepartmentDtoUnexpanded.Expand();