Ho questo errore: un tipo anonimo non può avere più proprietà con lo stesso nome. Se questo può essere risolto con alias vale a dire, se un alias esiste in LINQtipo anonimo e più proprietà
var device_query = from d in DevicesEntities.device
join dt in DevicesEntities.devicetype on d.DeviceTypeId equals dt.Id
join l in DevicesEntities.location on d.Id equals l.DeviceId
join loc in DevicesEntities.locationname on l.LocationNameId equals loc.Id
where l.DeviceId == d.Id
select new {
d.Id,
d.DeviceTypeId,
d.SerialNumber,
d.FirmwareRev,
d.ProductionDate,
d.ReparationDate,
d.DateOfLastCalibration,
d.DateOfLastCalibrationCheck,
d.CalCertificateFile,
d.Notes,
d.TestReportFile,
d.WarrantyFile,
d.CertificateOfOriginFile,
d.QCPermissionFile,
d.Reserved,
d.ReservedFor,
d.Weight,
d.Price,
d.SoftwareVersion,
dt.Name,
dt.ArticleNumber,
dt.Type,
l.StartDate, //AS LastStartDate,
l.LocationNameId,
loc.Name //in this line I have problem
};
@ognjenb - Non sono sicuro di quello che stai chiedendo. È vero che un tipo anonimo non può avere più proprietà con lo stesso nome. Ma come stai creando istanze di quel tipo? Stai chiedendo se LINQ creerà automaticamente un alias? Se si dispone di un codice di esempio, sarebbe di aiuto. Grazie. –