LINQ to SQL-Version von GROUP BY WITH ROLLUP

Ich versuche, etwas altes SQL in LINQ to SQL umzuschreiben. Ich habe einen Sproc mit einer GROUP BY WITH ROLLUP, bin mir aber nicht sicher, was das LINQ-Äquivalent wäre. LINQ hat ein GroupBy, aber es sieht nicht so aus, als würde es ROLLUP unterstützen.

Ein vereinfachtes Beispiel für die Ergebnisse, die ich erzielen möchte, wäre etwa Folgendes:

+-----------+---------------+--------------------+
|   City    |  ServicePlan  |  NumberOfCustomers |
+-----------+---------------+--------------------+
| Seattle   |  Plan A       |                 10 |
| Seattle   |  Plan B       |                  5 |
| Seattle   |  All          |                 15 |
| Portland  |  Plan A       |                 20 |
| Portland  |  Plan C       |                 10 |
| Portland  |  All          |                 30 |
| All       |  All          |                 45 |
+-----------+---------------+--------------------+

Gibt es Ideen, wie ich mit LINQ to SQL zu diesen Ergebnissen kommen kann?

Antworten auf die Frage(4)

Ihre Antwort auf die Frage