Linq To Sql return from function as IQueryable

前端 未结 4 1883
梦如初夏
梦如初夏 2021-01-13 04:54

Ok, I have managed to get the following working

public IQueryable getTicketInformation(int ticketID)
{
    var ticketDetails = from tickets in _context.ticke         


        
4条回答
  •  悲哀的现实
    2021-01-13 05:37

    Gents, It all makes sense as long as you're only returning single table, but what if there's two or more to be returned???

    RPDTDataContext smdt = new RPDTDataContext();
    var projectedUsers = smdt.SM_Users.Join(
            smdt.SM_CTSGroups, u => u.CtsGroupID, c => c.id, 
            (u, c) => new { CTSGroup = c.Name, UserName = u.Name, u.EmpID, u.Email });
    return projectedUsers;        
    

提交回复
热议问题