IQueryable<String> custQuery =
(from cust in db.Customers
select cust.Phone)
.Concat
(from cust in db.Customers
select cust.Fax)
.Concat
(from emp in db.Employees
select emp.HomePhone)
;
foreach (var custData in custQuery)
{
Console.WriteLine(custData);
}
var infoQuery =
(from cust in db.Customers
select new { Name = cust.CompanyName, cust.Phone }
)
.Concat
(from emp in db.Employees
select new
{
Name = emp.FirstName + " " + emp.LastName,
Phone = emp.HomePhone
}
);
foreach (var infoData in infoQuery)
{
Console.WriteLine("Name = {0}, Phone = {1}",
infoData.Name, infoData.Phone);
}'LINQ & Entity' 카테고리의 다른 글
| DataSet 을 Linq로 쿼리하기 (0) | 2010.10.06 |
|---|---|
| [URL]101 LINQ Samples (0) | 2010.04.26 |
| [Attach 메소드]연결되지 않은 엔티티는 제거할 수 없습니다. (0) | 2010.04.09 |
| dataContext 동시에 insert/ update /delete 진행하기 (0) | 2010.04.06 |
| [DataContext.Log] Linq 쿼리 로그보기 (0) | 2010.03.19 |
| Func(T, TResult) Delegate 사용해보기 (0) | 2010.02.24 |
| scottgu 아저씨 LINQ 쿼리 모음정리 (0) | 2010.02.23 |
| [LINQ TO SQL] DataContext에서 조인하기 (0) | 2010.02.23 |
| Lambda Expression Example (0) | 2010.02.23 |
| Using LINQ to SQL (0) | 2010.02.23 |