Replies: 1 comment 3 replies
-
Indeed, controllers and handlers use the There is no risk of performance problems because the LINQ Expression is translated into an SQL QUERY by EF Core. The filtering doesn't occur in memory. For example: LINQ EXPRESSION :
SQL STATEMENT :
As you can see, multiple SQL queries are executed because the Other ORMs such as SqlSugar can be used (https://github.com/DotNetNext/SqlSugar/tree/e5fb3cb36395908e7c24cc218554542e2f378f11/Src/Asp.Net/SqlSugar/ExpressionsToSql). |
Beta Was this translation helpful? Give feedback.
-
Hello,
Correct me if I'm wrong, but based on the current implementation, Handler Controllers etc. perform several queries based on Get all and then perform a LINQ to get the requested result.
For example, in the case of users :
var user = await _userRepository.Get(u => u
.Include(u => u.Consents).ThenInclude(c => c.Scopes).ThenInclude(c => c.AuthorizedResources)
.Include(u => u.Sessions)
.Include(u => u.Realms)
.Include(u => u.Groups)
.Include(u => u.OAuthUserClaims)
which means in every query we need to perform a "Select *" from the user's table (maybe for 1k records or more) and then LINQ to find the current user.
If there was a specific Interface that a dev could implement custom queries wouldn't it be more efficient in terms of performance, instead of using callbacks functions? (example replace Linq with SQL queries)
This also will provide the functionality to replace Entity Framework with any ORM
Beta Was this translation helpful? Give feedback.
All reactions