Linq Grouping by 2 keys as a one
- by Evgeny
Hello! I write a simple OLAP viewer for my web-site. Here are the classes (abstract example):
Employee
{
ID;
Name;
Roles[]; //What Employee can do
}
Order
{
Price;
Employee Manager;
Employee Executive; //Maybe wrong english. The person which perform order
}
Employee can be Manager and Executive in the order at the same time. This means that Employee role is not fixed.
I have to group orders by employees and finally get IGrouping with Employee key.
So .GroupBy(el=new {el.Manager,el.Executive}) is not allowed.
I considered some tricks with IEqualityComparable, but found no solution.
If somrbody will help I'll be vary glad, thank you.