优化linq查询的更好方法

我已经在c#应用程序中编写了一个linq查询,以获取auth用户所属的应用程序的名称

var authApplicationRepository = AuthApplicationRepository.GetallAsList();
var authUserRepository = AuthUserRepository.GetallAsList();

您认为将这两行结合起来是更好,更短的方法

//Get the name of the application the auth user belongs to
var authUserapplicationid = authUserRepository
                            .Where(x => x.Id == userChangeRequest.AuthUserId)
                            .Select(x => x.applicationid)
                            .FirstOrDefault();

var authUserApplicationName = authApplicationRepository
                              .Where(x => x.Id == authUserapplicationid)
                              .Select(x => x.Description)
                              .FirstOrDefault();
Sdfadfadf 回答:优化linq查询的更好方法

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3164890.html

大家都在问