|
using System;
using System.Collections.Generic;
using System.Linq;
namespace TestPatterns
{
/// <summary>Here we select each entity one at the time.</summary>
public static class SelectingEach
{
public static Order[] DoSelect(int[] ids)
{
using (var context = new EFDemoEntities())
{
var list = new List<Order>(3);
foreach (var id in ids)
{
var query = from o in context.Order.Include("OrderDetail")
where o.OrderID == id
select o;
var objectQuery = (System.Data.Objects.ObjectQuery)query;
var sql = objectQuery.ToTraceString();
list.AddRange(query);
}
return list.ToArray();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Vincent-Philippe is a Senior Solution Architect working in Montreal (Quebec, Canada).
His main interests are Windows Azure, .NET Enterprise suite (e.g. SharePoint 2013, Biztalk Server 2010) & the new .NET 4.5 platforms.