Linq를 사용하여 고객 및 인보이스가 포함 된 개체를 반환하고 싶습니다.여러 클래스를 IQueryable로 반환하는 방법 <T>
나는 방법에서 하나의 유형을 반환 이해 :
public IQueryable<customers> GetCustomers()
{
return from c in customers
select c;
}
을하지만 문제가 여러 개체를 알아내는 데 : 나는이 잘못된 방향으로 접근하고 느낌이
public IQueryable<???> GetCustomersWithInvoices()
{
return from c in customers
from inv in c.invoices
select new {c, ci} // or I may specify columns, but rather not.
}
합니다. 목표는 컨트롤러에서 이러한 객체를 호출하여 직접 또는 formViewModel 클래스를 사용하여 뷰에 전달하는 것입니다.
가능한 중복 [Return anonymous type?] (http://stackoverflow.com/questions/534690/return-anonymous-type) – nawfal