Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Concat 2 IQueryables

$
0
0

Hello.

I want to concat 2 IQueryables :

<div> <div>
var iq1 = 

db.Products
.Include(p => p.Category)
.Include("User")
.Include("Event")
.Include("Comments")
.Include("ProductImages")
.Include(e => e.ProductSpecifications)
.ThenInclude(e => e.Specification)
.AsNoTracking()
.Where(p => p.CategoryId == 12).OrderByDescending(p => p.Id);
and another one : </div> <div>
var iq2 = 

db.Products
.Include(p => p.Category)
.Include("User")
.Include("Event")
.Include("Comments")
.Include("ProductImages")
.Include(e => e.ProductSpecifications)
.ThenInclude(e => e.Specification)
.AsNoTracking()
.Where(p => p.CategoryId == 26).OrderByDescending(p => p.Id);
Now i want to merge this 2 IQueryables and show in Paginated List (using this article for paginated list and i need to send IQueryable<Product> to PaginatedList<Product>(...) )</div> <div>I used this code but i get error :</div> <div>
iq1 = iq1.Concat(iq2);
and error :</div> <div>
ArgumentException: The input sequence must have items of type 'Project.Models.Product', but it has items of type 'Microsoft.EntityFrameworkCore.Query.Internal.AnonymousObject'.
Parameter name: inputInfo
</div> </div>

Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>