using Entity Framework 4.1 is it possible to perform a left outer join with an IEnumerable?
For example, lets say i want to count the number of orders for each month.
var range = Enumerable.Range(1,6).AsQueryable();
var result = range
.GroupJoin(context.Orders, i => i, o => o.Month, new
{
Month = i,
Count = m.Count()
});
Which would produce the following
Month, Count
1, 0
2, 0
3, 10
4, 20
5, 0
6, 0
Only if you call
context.Orders.ToList()and load all orders to your application.IEnumerableis in your application memory andcontext.Ordersrepresent data in your database. You cannot join data in database with data in memory of your application. ConvertingIEnumerablebyAsQueryablewill not put it to database.To do your requirement directly with ADO.NET and SQL you must either create and fill temporary table and perform a database join or create stored procedure with table valued parameter to perform database join. Neither technique is supported by EF.