I'm using asp.net web forms 4.5
I'm trying to join two tables products and lots by
var query = _cc.products.Join(_db.lots,
p => p.parentLotIndex,
l => l.idx,
(p, l) => new {P = p, L = l});
int prodCount = query.Count();
Edit : This is many to 1 relationship. That is, there could be numbers of products related to a single lot. So the query is to find how many products are there in a given lot.
But this is giving me a weird error something like..
NotSupportedException was unhandled by user code.
The specified LINQ expression contains references to queries that are associated with different contexts.
And I don't know what this means. Please someone help me? Thanks in advance.
PS : by the way, executing the sql query in SQL management studio gave me the correct answer.. with standard sql queries.. so I guess I'm doing something wrong with linq.