Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help in understanding if its possible to combine/concat/union a list<iqueryable> with projection subqueries? #344

Open
aloksharma1 opened this issue Sep 8, 2023 · 2 comments

Comments

@aloksharma1
Copy link

aloksharma1 commented Sep 8, 2023

Hi, i have different complex search queries defined in a lot of IQueryables, which i materialize using this model:

 public class SearchResults 
 {
     public string? Id { get; set; }
     public string? Title { get; set; }
     public string? Desc { get; set; }
     public string? Summary { get; set; }
     public string? AuthorName { get; set; }
     public string? AuthorProfile { get; set; }
     public IList<SearchImages>? Images { get; set; }
     public IList<SearchFiles>? Videos { get; set; }
     public IList<SearchFiles>? Files { get; set; }
     public IList<SearchLinks>? Links { get; set; }
     public IList<string>? Htmls { get; set; }
     public string? Slug { get; set; }
     public DateTimeOffset? DatePublished { get; set; }
     public DateTimeOffset? DateCreated { get; set; }
     public int ResultOrder { get; set; } = -1000;
     public string? Category { get; set; }
     public string? CategoryTrail { get; set; }
     public string? Type { get; set; }
     public string? ProviderTable { get; set; }
 }

right now i am doing IEnumerable materialization because ef core cannot union or concat this sort of queries it gives error Unable to translate set operation after client projection has been applied. Consider moving the set operation before the last 'Select' call.

And if i try to do ToLinqtoDB on this query it gives error on sequence cannot be translated.

here my SearchImages?, SearchFiles? etc field contains projection queries from various tables. Is there no efficient way to combine these results in single call?

@MaceWindu
Copy link
Contributor

Not in current version. We are working on some improvements to parser in v6 version in this area which could help here.

Right, @sdanyliv ?

@sdanyliv
Copy link
Member

sequence cannot be translated is serious error, it can be not fixed in new translator. Better to show your LINQ query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants