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.8k stars 3.2k forks source link

Consider simplifying SQL parameter names (`@__city_0` -> `@city`) #35113

Open roji opened 1 week ago

roji commented 1 week ago

All our SQL parameters have a __ prefix; this is the result of an internal detail: the prefix allowed us to distinguish between query parameter (captured variables) and lambda parameters; we're effectively leaking an internal implementation detail to our SQL shape. #35089 removes this need: the two parameter types (query, lambda) are now clearly distinguished via different node types. Since the prefix is no longer needed for EF's purposes, it can be removed, simplifying our parameter names.

We can also take this opportunity to make some other simplifications. For example, we append a running counter to parameter names in case the same name is used twice - an exceedingly rare situation. We can append the number only for that case, leading to most parameters being named more naturally (@city).