Reputation: 1705
There seems to be a Bug with the Outer Join statement in SubSonic 3, or maybe it's just my ignorance, but the following craps out:
var Objeto = from t in Table1.All()
join su in table2.All() on t.Id equals su.Id
join tab2 in Table1.All() on t.PId equals tab2.Id into gj
from j in gj.DefaultIfEmpty()
select new
{
t.Field1,
SN = su.Field123,
PTN = (j == null ? null : j.FieldABC)
};
With:
The expression of type 'System.Linq.IQueryable` xxxx is not a sequence
Upvotes: 1
Views: 434
Reputation: 43718
Reviving an old topic here, but for those that come searching along later, there is a different syntax that seems to work correctly in SubSonic3 for a left outer join.
Instead of the Linq expression from the original post that does a join ... into ...
Rewrite it to:
var Objeto = from t in Table1.All()
join su in table2.All() on t.Id equals su.Id
from j in Table1.All().Where(x => x.Id == t.PId).DefaultIfEmpty()
select new
{
t.Field1,
SN = su.Field123,
PTN = (j == null ? null : j.FieldABC)
};
The key part being: from j in Table1.All().Where(x => x.Id == t.PId).DefaultIfEmpty()
which will do the outer join, instead of the traditional join ... into
Hopefully this helps!
Upvotes: 1
Reputation: 2069
They already had issues with IQueryable:
Just for your Information...
Upvotes: 0