如何提高以下linq查询的性能?
在运行它时,它引发了System.OutOfMemoryException
的错误。
注意:我在XrmContext.sun_POSSet
实体
var a = (from temple in XrmContext.sun_POSSet
select new POS()
{
id = temple.Id,
Country = temple.sun_sun_country_sun_POS == null ? "" : temple.sun_sun_country_sun_POS.sun_name,
CountryId = temple.sun_sun_country_sun_POS == null ? "" : temple.sun_sun_country_sun_POS.Id.ToString(),
stringint = temple.sun_sun_stringint_sun_placeofstu == null ? "" : temple.sun_sun_stringint_sun_placeofstu.sun_name,
stringintId = temple.sun_sun_stringint_sun_placeofstu == null ? "" : temple.sun_sun_stringint_sun_placeofstu.Id.ToString(),
FullName = temple.sun_contact_sun_POS.FullName,
EMail = temple.sun_contact_sun_POS.EMailAddress1,
MobilePhone = temple.sun_contact_sun_POS.MobilePhone
}).ToList<POS>();