Hi,

I am trying to concatenate query results but for some reason I can only do one union. If try to execution an union on the result of the first union I get an error:

   var staff = from s in session.Query.All<BVAgencyStaff>() where s.BondingVisit.Id == 13057 select new { Id = s.Id, Name = s.AgencyStaff.FirstName, staff_type = "S"  };

    var Volunteers = from v in session.Query.All<BVVolunteer>() where v.BondingVisit.Id == 13057 select new { Id = v.Id, Name = v.Volunteer.FirstName, staff_type = "V"};

    var Guests = from g in session.Query.All<BVGuest>() where g.BondingVisit.Id == 13057 select new { Id = g.Id, Name = g.Guest.FirstName, staff_type = "G" };

staff = staff.Union(Guests) // is successful

var Allstaff = staff.Union(Volunteers) // error here

If I change the order of the union I still get the error. So is not the entity issue.

Here is is the error.

Thank you,

Richard

Xtensive.Orm.QueryTranslationException was unhandled HResult=-2146233088 Message=Unable to translate 'Query.All().Where(g => (g.BondingVisit.Id == 13057)).Select(g => new @<id, name,="" staff_type="">( g.Id, g.Guest.FirstName, "G" )).Union(Query.All().Where(v => (v.BondingVisit.Id == 13057)).Select(v => new @<id, name,="" staff_type="">( v.Id, v.Volunteer.FirstName, "V" ))).Union(Query.All().Where(s => (s.BondingVisit.Id == 13057)).Select(s => new @<id, name,="" staff_type="">( s.Id, s.AgencyStaff.FirstName, "S" ))).Count()' expression. See inner exception for details. Source=Xtensive.Orm StackTrace: at Xtensive.Orm.Linq.QueryProvider.TranslateTResult at Xtensive.Orm.Linq.QueryProvider.ExecuteTResult at System.Linq.Queryable.CountTSource at Xtensive.Orm.Linq.QueryProvider.TranslateTResult InnerException:

Richard

asked Apr 16 '14 at 16:07

rasxte's gravatar image

rasxte
20161617

Hello Richard, unfortunately I can't help you with this information. Could you provide inner exception as well? It contains important details for this error.

(Apr 17 '14 at 03:00) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Hi Denis,

I don't know why but today the problem is not happening anymore. Very strange....

I'll let you know if I come across it again.

Thank you,

Richard

(Apr 17 '14 at 10:43) rasxte rasxte's gravatar image
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA