0

我试图在 linq 中编写一个查询,在其中加入 3 个表格并用字符串“ANY”填充空值,但这没有发生,需要一些帮助,请我是新手。

我试着做这样的事情......

var results = from user in allusers
              join building in allbuildings where building.buildingid equals user.buildingid
              into BuildingAndUsers.FirstorDefault(new allbuildings{BuildingName="ANY" BuildingID=0})
              from blah in BuildingAndUsers
              join Site in AllSites where ....
4

1 回答 1

1

就像是:

var results = 
      from user in allusers
      join building in allbuildings on building.buildingid equals user.buildingid
          into BuildingAndUsers 
      from buildingAndUser in BuildingAndUsers.DefaultIfEmpty(new allbuildings { BuildingName="ANY", BuildingID=0 })
      join Site in AllSites on ....
          into BuildingAndUsersAndSites
      from buildingAndUsersAndSite in BuildingAndUsersAndSites.DefaultIfEmpty()
      select ...
于 2013-02-28T09:41:36.727 回答