dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.68k stars 3.16k forks source link

Add names for more/all(?) parameters (and lambdas) we generate in materializer code #33446

Open maumar opened 6 months ago

maumar commented 6 months ago

Currently we generate names for some of the parameters and not others. Good thing about not naming parameters is that we can never get a clash (since compiler generates the names for us). But the drawback is that the code is less readable and harder to understand and correlate output with the piece of materializer code that generates it.

roji commented 6 months ago

FWIW unless I'm mistaken, even if there's a clash, that shouldn't matter to the expression tree compiler etc. And for precompiled queries (LinqToCSharpTranslator), we apply uniquification there in any case - so this shouldn't have a downside, only readability benefits.

If we want, we can also have a DEBUG-only visitor that validates that all parameters and lambdas are named.