Your query:
var qDef = from a in mData.TableA
join b in mData.TableB on new { a.FirstId, a.SecondId } equals new { b.FirstId, b.SecondId }
select a;
creates two anonymous types, not 1, I think because the fieldnames aren't exactly the same. Example (which gives the same error: )
var q = from od in metaData.OrderDetail
join o in metaData.Order on new { od.OrderId, od.ProductId } equals new { o.OrderId, o.EmployeeId.Value }
select od;
This creates two anonymous types. One with the fields OrderId and ProductId and the other one with OrderId and Value.
As the 'join' keyword is converted by the C# compiler to a .Join() method call, it needs the values in the 'equals' section to be of the same type. As 2 anonymous types are created, this won't work.
This will:
var q = from od in metaData.OrderDetail
join o in metaData.Order on new { F1 = od.OrderId, F2 = od.ProductId } equals new { F1 = o.OrderId, F2 = o.EmployeeId.Value }
select od;
here, just 1 anonymous type is created, with 2 fields, F1 and F2.
Does this solve your problem?