Suggestion: Improve formatting of chained .Include() and .ThenInclude() in EF Core queries
When using Entity Framework Core, readability is greatly improved by clearly indicating navigation relationships. Currently, CSharpier formats chained .Include() and .ThenInclude() methods without indentation differentiation, which can obscure their relationship.
The additional indentation on .ThenInclude() visually represents the hierarchy and makes the code clearer at a glance.
Input:
var user = context.Users.Include(u => u.Orders).ThenInclude(o => o.OrderItems).Where(u => u.Id == userId).FirstOrDefault();
Output:
var user = context.Users
.Include(u => u.Orders)
.ThenInclude(o => o.OrderItems)
.Where(u => u.Id == userId)
.FirstOrDefault();
Expected behavior:
var user = context.Users
.Include(u => u.Orders)
.ThenInclude(o => o.OrderItems)
.Where(u => u.Id == userId)
.FirstOrDefault();
The additional indentation on .ThenInclude() visually represents the navigation hierarchy clearly.
Would this be something worth considering?
And also, thanks for your awesome work!
Suggestion: Improve formatting of chained
.Include()and.ThenInclude()in EF Core queriesWhen using Entity Framework Core, readability is greatly improved by clearly indicating navigation relationships. Currently, CSharpier formats chained
.Include()and.ThenInclude()methods without indentation differentiation, which can obscure their relationship.The additional indentation on
.ThenInclude()visually represents the hierarchy and makes the code clearer at a glance.Input:
Output:
Expected behavior:
The additional indentation on
.ThenInclude()visually represents the navigation hierarchy clearly.Would this be something worth considering?
And also, thanks for your awesome work!