로 변환 할 수 없습니다. 검사 결과를 반환하는 내 도메인 서비스 (VS 2010 Silverlight Business Application)에서 쿼리를 만들려고합니다. 당신이 볼 수 있듯이, 지역 및 위치에 따라 위치에 대한 검사 수치가,'System.Collections.Generic.List <T>'형식을 'System.Linq.IQueryable <T>'
Locations
a) Inspections
b) InspectionItems
c) InspectionReadings
a) Areas
b) Inspections
c) InspectionItems
d) InspectionReadings
그래서 : 특정 값으로 나온 수치는, 내 데이터베이스로 설정됩니다. 나는 쿼리의 결과를 반환하기 위해 사용하고
public class StatusList
{
[Key]
[Editable(false)]
public Guid ID { get; set; }
public string LocationName { get; set; }
public DateTime LastInspectionDate { get; set; }
public string Status { get; set; }
}
: 나는 POCO라는 이름 StatusList이
public IQueryable<StatusList> GetLocationStatus()
{
var status = (from location in this.ObjectContext.Locations
where location.InspectionReadings.Status == value
orderby a.DateTaken
select new LocationStatusList()
{
ID = a.ID,
LocationName = d.Name,
}).ToList<StatusList>();
return status;
}
불행하게도,이 제목에 오류를 반환하는 것 및 그 이유 등 아무 생각이 없다 목록 분명히 목록 항목이며, 난 당신이라고했습니다 때문에 문제가 정확하게 인 결과
.ToList<LocationStatusList>
왜'GetLocationStatus'에서'IQueryable'을 돌려 주겠습니까? 'IQueryable'은 (비공식적으로 말해서) 원격 위치에있는 열거 가능한 것들을 표현하는데 사용됩니다. 결과로 지역 목록을 만들었습니다. 이것은 단순히 'IEnumerable'입니다. – phg
LINQ to SQL 또는 LINQ to Enities입니까? 나에게 후자처럼 보인다. –
LINQ to Entitites - 미안하다! – xhedgepigx