Nested .Union() & .Concat() - NotSupportedException
Posted: Wed 24 Feb 2010 22:25
We're having an issue that results in the following stack:
This is as small as I could get the example still showing the error (Normal LinqPad .Dump() method):
As far as I can tell, placing a where clause on any joined table in the union causes the Specified method is not supported error, if you change the top query to:
It works fine, but of course we're joining because we need the where clause elsewhere. I'd be happy to place this in a small test project if you have trouble reproducing, but this has become a very urgent issue for us (unexpected client deliverable), we would appreciate a reply asap. Thanks for the help guys, your support is superb.
Almost forgot, this is on the latest beta 5.55.97 (this behavior has existed for a long time, but we've been able to bypass around it until now).
Code: Select all
Specified method is not supported.
at Devart.Data.Linq.Provider.Query.ao.a(SqlNode A_0, f A_1, SqlExpression A_2, Boolean A_3)
at Devart.Data.Linq.Provider.Query.bf.b.a(w A_0)
at Devart.Data.Linq.Provider.Query.SqlVisitor.a(f A_0)
at Devart.Data.Linq.Provider.Query.SqlVisitor.a(d A_0)
at Devart.Data.Linq.Provider.Query.SqlVisitor.a(j A_0)
at Devart.Data.Linq.Provider.Query.SqlVisitor.e(w A_0)
at Devart.Data.Linq.Provider.Query.bf.b.a(w A_0)
at Devart.Data.Linq.Provider.Query.SqlVisitor.a(f A_0)
at Devart.Data.Linq.Provider.Query.bf.a(SqlNode A_0, SqlFactory A_1, Boolean& A_2)
at Devart.Data.Linq.Provider.DataProvider.a(e A_0, Type A_1, SqlNode A_2, IList`1 A_3)
at Devart.Data.Linq.Provider.DataProvider.a(Expression A_0)
at Devart.Data.Linq.Provider.DataProvider.i(Expression A_0)
at Devart.Data.Linq.DataQuery`1.i()
Code: Select all
var DB = new DataContext(ConnectionString);
var a = from d in DB.Documents
join spd in DB.SitePacketDocuments on d equals spd.Document
where spd.Id == 1
select new {SiteId = 5, DocId = d.Id};
var b = from d in DB.Documents
select new {SiteId = 5, DocId = d.Id};
var u = a.Concat(b);
DB.GetCommand(u).CommandText.Dump(); //Ok here
var sitedocs = (from d in DB.Documents
join did in u on d.Id equals did.DocId
select new { did.SiteId, DocumentId = d.Id });
DB.GetCommand(sitedocs).CommandText.Dump(); //Not so ok
Code: Select all
var a = from d in DB.Documents
join spd in DB.SitePacketDocuments on d equals spd.Document
where d.Id == 1
select new {SiteId = 5, DocId = d.Id};
Almost forgot, this is on the latest beta 5.55.97 (this behavior has existed for a long time, but we've been able to bypass around it until now).