mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
更新 AuthorizeApp.cs AuthoriseService.cs=>public List<ModuleElement> ModuleElements { get { return GetModuleElementsQuery().ToList(); } } 会导致重复查询数据库。在user.Modules较多的时候影响性能。
This commit is contained in:
parent
ee5e0294ff
commit
fd9bca23a7
@ -1,4 +1,4 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using OpenAuth.App.Response;
|
using OpenAuth.App.Response;
|
||||||
using OpenAuth.Repository.Domain;
|
using OpenAuth.Repository.Domain;
|
||||||
@ -41,10 +41,12 @@ namespace OpenAuth.App
|
|||||||
Roles = service.Roles
|
Roles = service.Roles
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var ModuleElements=service.ModuleElements;
|
||||||
|
|
||||||
foreach (var moduleView in user.Modules)
|
foreach (var moduleView in user.Modules)
|
||||||
{
|
{
|
||||||
moduleView.Elements =
|
moduleView.Elements =
|
||||||
service.ModuleElements.Where(u => u.ModuleId == moduleView.Id).OrderBy(u => u.Sort).ToList();
|
ModuleElements.Where(u => u.ModuleId == moduleView.Id).OrderBy(u => u.Sort).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
|
Loading…
Reference in New Issue
Block a user