anonymous type and multiple properties

Posted by ognjenb on Stack Overflow See other posts from Stack Overflow or by ognjenb
Published on 2010-04-28T08:46:19Z Indexed on 2010/04/28 8:53 UTC
Read the original article Hit count: 150

Filed under:

I have this error: An anonymous type cannot have multiple properties with the same name. Whether this can be resolved with alias ie, whether an alias exists in LINQ

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
                           };

© Stack Overflow or respective owner

Related posts about LINQ