score:5

Accepted answer

add following line to your query

var pagedquery = data.skip(pageindex * pagesize).take(pagesize); 

the data variable is iqueryable, so you can put add skip & take method on it. and if you have relationship between product & variant, you donot really require to have join explicitly, you can refer the variant something like this

iqueryable<productinventory> data = 
             from inventory in objcontext.productinventory
             where inventory.productid == productid && inventory.storeid == storeid
             orderby inventory.variant.sortorder
             select new()
             {
                 property1 = inventory.variant.variantid,
                 //rest of the properties go here
             }
pagedquery = data.skip(pageindex * pagesize).take(pagesize); 

score:0

you would simply use your skip(itemsinpage * pageno).take(itemsinpage) to do paging.

score:1

my answer here based on the answer that is marked as true but here i add a new best practice of the code above

    var data= (from c in db.categorie.asqueryable().join(db.categorymap,
                    cat=> cat.categoryid, catmap => catmap.childcategoryid, 
    cat, catmap) => new { category = cat, categorymap = catmap })
select (c => c.category)

this is the best practice to use the linq to entity because when you add asqueryable() to your code; system will converts a generic system.collections.generic.ienumerable to a generic system.linq.iqueryable which is better for .net engine to build this query at run time

thank you mr. khumesh kumawat

score:8

define the join in your mapping, and then use it. you really don't get anything by using the join method - instead, use the include method. it's much nicer.

var data = objcontext.productinventory.include("variant")
               .where(i => i.productid == productid && i.storeid == storeid)
               .orderby(j => j.variant.sortorder)
               .skip(x)
               .take(y);

Related Query

More Query from same tag