Asp.net mvc 在LINQ查询中,查询主体必须以select子句或group子句结尾
第一次查询需要使用Asp.net mvc 在LINQ查询中,查询主体必须以select子句或group子句结尾,asp.net-mvc,linq,Asp.net Mvc,Linq,第一次查询需要使用Where扩展方法,因为该查询使用带DefaultIfEmpty的左连接(请注意,不能在Where之后使用into子句,因为Where后面必须跟有select以完成查询): 类似问题: 第一次查询需要使用Where扩展方法,因为查询使用了带DefaultIfEmpty的左连接(请注意,您不能在Where之后使用into子句,因为Where后面必须跟有select来完成查询): 类似问题: 请以可读的方式格式化代码。提示:缩进4个空格。问题或疑问究竟是什么?问题或疑问是什么?
Where
扩展方法,因为该查询使用带DefaultIfEmpty
的左连接(请注意,不能在Where
之后使用into
子句,因为Where
后面必须跟有select
以完成查询):
类似问题:
第一次查询需要使用
Where
扩展方法,因为查询使用了带DefaultIfEmpty
的左连接(请注意,您不能在Where
之后使用into
子句,因为Where
后面必须跟有select
来完成查询):
类似问题:
请以可读的方式格式化代码。提示:缩进4个空格。问题或疑问究竟是什么?问题或疑问是什么?查询体的into get error必须以LINQ query中的select子句或group子句结尾。代码中的
**into**MM
是什么意思?请以可读的方式格式化代码。提示:缩进4个空格。问题或疑问究竟是什么?问题或疑问是什么?在LINQ查询中,into get error必须以select子句或group子句结尾。在代码中,**into**MM
是什么意思?
model.ListManagerReviewerMapping = (from a in wallet.OM_Employee
join m in wallet.APPR_ManagerMapping
on a.AssociateId equals m.AssociateId
where m.ManagerId==Context.UserId.Value **into** MM
from leftjoinresult in M.DefaultIfEmpty()
where a.CompanyId == Context.CompanyId && (a.TermStatus == "L" || a.SeparationDate > DateTime.Today)
select new ManagerAndReviewerMappingModel.ManagerAndReviewerMapping()
{
Photo = (photoUrl + "?AssociateCode=" + a.AssociateCode),
AssociateId = a.AssociateId,
AssociateCode = a.AssociateCode,
AssociateName = a.AssociateName
}).ToList();
//Remove brackets and .ToList();
model.ListManagerReviewerMapping = from a in wallet.OM_Employee
join m in wallet.APPR_ManagerMapping
on a.AssociateId equals m.AssociateId
where m.ManagerId==Context.UserId.Value **into** MM
from leftjoinresult in M.DefaultIfEmpty()
where a.CompanyId == Context.CompanyId && (a.TermStatus == "L" || a.SeparationDate > DateTime.Today)
select new ManagerAndReviewerMappingModel.ManagerAndReviewerMapping()
{
Photo = (photoUrl + "?AssociateCode=" + a.AssociateCode),
AssociateId = a.AssociateId,
AssociateCode = a.AssociateCode,
AssociateName = a.AssociateName
};
model.ListManagerReviewerMapping = (from a in wallet.OM_Employee
join m in wallet.APPR_ManagerMapping.Where(x => x.ManagerId == Context.UserId.Value)
on a.AssociateId equals m.AssociateId into MM
from leftjoinresult in MM.DefaultIfEmpty()
where a.CompanyId == Context.CompanyId && (a.TermStatus == "L" || a.SeparationDate > DateTime.Today)
select new ManagerAndReviewerMappingModel.ManagerAndReviewerMapping()
{
Photo = (photoUrl + "?AssociateCode=" + a.AssociateCode),
AssociateId = a.AssociateId,
AssociateCode = a.AssociateCode,
AssociateName = a.AssociateName
}).ToList();