Use CTE (with clause) instead of derived tables in generated queries.
SQL Generated code would be much more readeable if you would use common table expressions instead of derived table. Just choose the name you want for the CTE and move the code generated for the derived table into the CTE, and replace the derived table expression by the name of the CTE. The resulting code is then no more indented. You can also take the opportunity to properly name the CTE to give an hint about which part of the linq expression result in the CTE generation. This improvement should not be complex to implement, and would help us and your team about understanding which part of linq expression was turned into a specific T-SQL expression. A lot of dbms platforms support CTE (SQL Server,Oracle, DB2, and probably more).