- IList<RDEquipment> list = null;
- list = (from c in gc.GasEquipmentDetail
- join d in gc.GasCompanyRD on c.ForeignID equals d.ID
- join e in gc.GasAttachment on new { ID = c.ID, SourceType = Convert.ToInt32(AttachmentSourceType.Equipment) } equals new { ID = (int)e.SourceID, SourceType = (int)e.SourceType } into EquipmentAtt
- join g in gc.GasDictionary on c.Type equals g.ID
- from att in EquipmentAtt.DefaultIfEmpty()
- where g.Category == "RDEquipment"
- && d.ID == forid
- && c.IsDeleted == 0
- select new RDEquipment
- {
- EquipmentType = g.Title,
- EqpID = c.ID,
- EquipmentName = c.EquipmentName,
- Quantity = c.Quantity,
- AttID = att.ID,
- FileName = att.FileName,
- FilePath = Gasgoo.Framework.AttachDirFactory.GetAttachPath(AttachmentSourceType.Equipment, att.FilePath)
- }).ToList<RDEquipment>();
equals new { ID = (int)e.SourceID, SourceType = (int)e.SourceType }
相当于sql语句中join ... on c.ID=e.SourceID and sourcetype=e.sourcetype