Efficient pagination using OFFSET-FETCH on SQL Server.
| ID | Name | Category | Price | Stock | Rating | Reviews | SKU |
|---|---|---|---|---|---|---|---|
| 2250 | Standard Food & Grocery Product XL | Food & Grocery | $529.69 | 72 | ★ 2.6 | 674 | SKU-002250 |
| 2252 | Super Home & Garden Product Classic | Home & Garden | $602.16 | 310 | ★ 3.2 | 919 | SKU-002252 |
| 2253 | Economy Clothing Product Special Edition | Clothing | $914.28 | 373 | ★ 4.3 | 593 | SKU-002253 |
| 2254 | Premium Clothing Product Pro | Clothing | $498.04 | 132 | ★ 1.6 | 895 | SKU-002254 |
| 2255 | Professional Books Product 2024 | Books | $421.84 | 106 | ★ 1.6 | 897 | SKU-002255 |
| 2256 | Standard Books Product XL | Books | $200.25 | 200 | ★ 4.9 | 262 | SKU-002256 |
| 2257 | Ultra Office Supplies Product Special Edition | Office Supplies | $835.04 | 35 | ★ 4.2 | 55 | SKU-002257 |
| 2258 | Super Toys & Games Product Lite | Toys & Games | $272.29 | 274 | ★ 2.2 | 992 | SKU-002258 |
| 2259 | Elite Sports & Outdoors Product Lite | Sports & Outdoors | $621.25 | 486 | ★ 1.7 | 184 | SKU-002259 |
| 2260 | Professional Clothing Product Classic | Clothing | $87.64 | 379 | ★ 3.2 | 264 | SKU-002260 |
| 2261 | Elite Books Product 2024 | Books | $724.48 | 200 | ★ 4.9 | 660 | SKU-002261 |
| 2262 | Mega Books Product Max | Books | $950.04 | 473 | ★ 4.3 | 578 | SKU-002262 |
| 2263 | Deluxe Sports & Outdoors Product Pro | Sports & Outdoors | $278.26 | 274 | ★ 4.7 | 213 | SKU-002263 |
| 2264 | Standard Automotive Product Advanced | Automotive | $664.67 | 287 | ★ 3.8 | 599 | SKU-002264 |
| 2266 | Deluxe Electronics Product Classic | Electronics | $780.66 | 499 | ★ 1.2 | 471 | SKU-002266 |
| 2267 | Deluxe Toys & Games Product 2024 | Toys & Games | $301.00 | 444 | ★ 3.3 | 497 | SKU-002267 |
| 2268 | Professional Electronics Product Classic | Electronics | $297.15 | 94 | ★ 4.2 | 208 | SKU-002268 |
| 2269 | Premium Home & Garden Product Pro | Home & Garden | $689.32 | 414 | ★ 4.3 | 278 | SKU-002269 |
| 2270 | Super Health & Beauty Product Lite | Health & Beauty | $531.57 | 230 | ★ 2.0 | 59 | SKU-002270 |
| 2271 | Super Sports & Outdoors Product XL | Sports & Outdoors | $761.92 | 467 | ★ 2.1 | 909 | SKU-002271 |
| 2272 | Deluxe Clothing Product Mini | Clothing | $820.21 | 230 | ★ 2.9 | 403 | SKU-002272 |
| 2273 | Standard Books Product XL | Books | $459.51 | 495 | ★ 2.9 | 176 | SKU-002273 |
| 2274 | Economy Sports & Outdoors Product Advanced | Sports & Outdoors | $362.08 | 106 | ★ 3.6 | 302 | SKU-002274 |
| 2275 | Mega Books Product Plus | Books | $614.44 | 79 | ★ 3.7 | 35 | SKU-002275 |
| 2276 | Ultra Clothing Product Plus | Clothing | $501.15 | 361 | ★ 4.3 | 250 | SKU-002276 |
| 2277 | Professional Home & Garden Product Max | Home & Garden | $798.34 | 29 | ★ 4.7 | 588 | SKU-002277 |
| 2278 | Elite Office Supplies Product Plus | Office Supplies | $454.98 | 291 | ★ 4.8 | 523 | SKU-002278 |
| 2279 | Super Food & Grocery Product Special Edition | Food & Grocery | $385.64 | 291 | ★ 3.3 | 505 | SKU-002279 |
| 2280 | Pro Health & Beauty Product Pro | Health & Beauty | $837.74 | 203 | ★ 2.1 | 754 | SKU-002280 |
| 2281 | Ultra Sports & Outdoors Product Pro | Sports & Outdoors | $166.80 | 359 | ★ 4.1 | 6 | SKU-002281 |
| 2282 | Professional Books Product Lite | Books | $704.08 | 115 | ★ 2.1 | 741 | SKU-002282 |
| 2283 | Super Toys & Games Product Advanced | Toys & Games | $739.41 | 341 | ★ 3.1 | 262 | SKU-002283 |
| 2284 | Economy Food & Grocery Product 2024 | Food & Grocery | $381.10 | 107 | ★ 4.4 | 272 | SKU-002284 |
| 2285 | Premium Health & Beauty Product Mini | Health & Beauty | $759.49 | 268 | ★ 4.9 | 602 | SKU-002285 |
| 2286 | Pro Clothing Product Advanced | Clothing | $163.46 | 123 | ★ 1.6 | 708 | SKU-002286 |
| 2288 | Elite Food & Grocery Product Plus | Food & Grocery | $471.76 | 172 | ★ 3.8 | 88 | SKU-002288 |
| 2289 | Professional Toys & Games Product Lite | Toys & Games | $85.22 | 447 | ★ 3.9 | 911 | SKU-002289 |
| 2290 | Mega Electronics Product Pro | Electronics | $133.77 | 60 | ★ 1.6 | 494 | SKU-002290 |
| 2291 | Elite Books Product Advanced | Books | $23.72 | 116 | ★ 2.3 | 394 | SKU-002291 |
| 2292 | Elite Food & Grocery Product Special Edition | Food & Grocery | $890.43 | 370 | ★ 2.9 | 487 | SKU-002292 |
| 2294 | Mega Home & Garden Product 2024 | Home & Garden | $83.25 | 205 | ★ 3.1 | 972 | SKU-002294 |
| 2296 | Premium Home & Garden Product 2024 | Home & Garden | $379.96 | 238 | ★ 3.4 | 757 | SKU-002296 |
| 2298 | Economy Automotive Product 2024 | Automotive | $27.99 | 367 | ★ 1.2 | 965 | SKU-002298 |
| 2299 | Economy Health & Beauty Product Plus | Health & Beauty | $891.92 | 368 | ★ 4.3 | 922 | SKU-002299 |
| 2300 | Mega Toys & Games Product Plus | Toys & Games | $723.69 | 402 | ★ 2.6 | 326 | SKU-002300 |
| 2301 | Professional Office Supplies Product 2024 | Office Supplies | $510.01 | 234 | ★ 2.8 | 6 | SKU-002301 |
| 2302 | Mega Books Product Plus | Books | $877.67 | 158 | ★ 2.2 | 867 | SKU-002302 |
| 2303 | Super Clothing Product Lite | Clothing | $638.46 | 5 | ★ 1.5 | 836 | SKU-002303 |
| 2304 | Economy Sports & Outdoors Product Pro | Sports & Outdoors | $607.87 | 451 | ★ 4.0 | 645 | SKU-002304 |
| 2305 | Standard Clothing Product Classic | Clothing | $387.57 | 263 | ★ 4.1 | 783 | SKU-002305 |
| 2306 | Economy Home & Garden Product Special Edition | Home & Garden | $937.71 | 364 | ★ 1.0 | 752 | SKU-002306 |
| 2307 | Ultra Home & Garden Product Max | Home & Garden | $691.15 | 164 | ★ 4.0 | 923 | SKU-002307 |
| 2308 | Economy Clothing Product Mini | Clothing | $66.83 | 354 | ★ 2.8 | 46 | SKU-002308 |
| 2309 | Ultra Sports & Outdoors Product 2024 | Sports & Outdoors | $421.90 | 80 | ★ 1.7 | 9 | SKU-002309 |
| 2310 | Elite Sports & Outdoors Product Special Edition | Sports & Outdoors | $363.78 | 70 | ★ 2.3 | 828 | SKU-002310 |
| 2311 | Economy Clothing Product Special Edition | Clothing | $261.52 | 147 | ★ 4.5 | 22 | SKU-002311 |
| 2312 | Super Automotive Product Pro | Automotive | $198.32 | 274 | ★ 2.4 | 729 | SKU-002312 |
| 2313 | Pro Health & Beauty Product 2024 | Health & Beauty | $801.29 | 83 | ★ 1.1 | 356 | SKU-002313 |
| 2314 | Super Automotive Product Lite | Automotive | $346.86 | 117 | ★ 2.7 | 681 | SKU-002314 |
| 2316 | Economy Food & Grocery Product XL | Food & Grocery | $552.98 | 43 | ★ 2.3 | 583 | SKU-002316 |
| 2318 | Mega Books Product Pro | Books | $771.33 | 69 | ★ 4.6 | 502 | SKU-002318 |
| 2319 | Economy Toys & Games Product Advanced | Toys & Games | $192.31 | 109 | ★ 2.3 | 144 | SKU-002319 |
| 2320 | Premium Automotive Product Plus | Automotive | $50.84 | 360 | ★ 3.1 | 313 | SKU-002320 |
| 2321 | Professional Sports & Outdoors Product Mini | Sports & Outdoors | $702.08 | 59 | ★ 1.8 | 460 | SKU-002321 |
| 2322 | Elite Electronics Product XL | Electronics | $443.20 | 222 | ★ 3.6 | 937 | SKU-002322 |
| 2323 | Ultra Health & Beauty Product Max | Health & Beauty | $36.29 | 12 | ★ 2.7 | 771 | SKU-002323 |
| 2324 | Standard Office Supplies Product Lite | Office Supplies | $433.08 | 155 | ★ 2.5 | 257 | SKU-002324 |
| 2325 | Deluxe Clothing Product 2024 | Clothing | $185.21 | 301 | ★ 2.9 | 593 | SKU-002325 |
| 2327 | Super Electronics Product Mini | Electronics | $663.71 | 202 | ★ 2.7 | 205 | SKU-002327 |
| 2329 | Super Automotive Product Advanced | Automotive | $157.96 | 456 | ★ 4.5 | 443 | SKU-002329 |
| 2330 | Economy Toys & Games Product Plus | Toys & Games | $336.74 | 2 | ★ 2.4 | 915 | SKU-002330 |
| 2331 | Deluxe Health & Beauty Product 2024 | Health & Beauty | $811.89 | 111 | ★ 4.0 | 666 | SKU-002331 |
| 2332 | Economy Office Supplies Product Classic | Office Supplies | $341.19 | 197 | ★ 1.6 | 45 | SKU-002332 |
| 2334 | Professional Office Supplies Product Advanced | Office Supplies | $572.94 | 179 | ★ 2.1 | 582 | SKU-002334 |
| 2336 | Mega Sports & Outdoors Product Advanced | Sports & Outdoors | $138.20 | 113 | ★ 3.5 | 945 | SKU-002336 |
| 2337 | Mega Electronics Product Lite | Electronics | $105.15 | 255 | ★ 1.8 | 377 | SKU-002337 |
| 2338 | Pro Home & Garden Product Special Edition | Home & Garden | $532.37 | 327 | ★ 3.7 | 992 | SKU-002338 |
| 2339 | Elite Office Supplies Product Classic | Office Supplies | $769.07 | 365 | ★ 1.3 | 690 | SKU-002339 |
| 2340 | Elite Books Product Special Edition | Books | $843.21 | 52 | ★ 5.0 | 879 | SKU-002340 |
| 2341 | Premium Automotive Product Mini | Automotive | $186.90 | 18 | ★ 1.7 | 104 | SKU-002341 |
| 2344 | Super Food & Grocery Product Lite | Food & Grocery | $981.81 | 495 | ★ 4.7 | 162 | SKU-002344 |
| 2345 | Standard Home & Garden Product Plus | Home & Garden | $835.84 | 455 | ★ 1.3 | 112 | SKU-002345 |
| 2346 | Pro Electronics Product XL | Electronics | $861.14 | 405 | ★ 1.2 | 797 | SKU-002346 |
| 2347 | Super Office Supplies Product Special Edition | Office Supplies | $338.41 | 264 | ★ 2.5 | 327 | SKU-002347 |
| 2348 | Super Office Supplies Product Mini | Office Supplies | $706.75 | 369 | ★ 1.5 | 212 | SKU-002348 |
| 2349 | Mega Home & Garden Product Max | Home & Garden | $313.30 | 337 | ★ 1.2 | 30 | SKU-002349 |
| 2350 | Premium Toys & Games Product Special Edition | Toys & Games | $349.45 | 389 | ★ 1.2 | 96 | SKU-002350 |
| 2351 | Economy Health & Beauty Product Advanced | Health & Beauty | $967.47 | 89 | ★ 5.0 | 616 | SKU-002351 |
| 2352 | Standard Office Supplies Product Classic | Office Supplies | $445.88 | 414 | ★ 1.7 | 727 | SKU-002352 |
| 2353 | Economy Home & Garden Product Pro | Home & Garden | $954.12 | 111 | ★ 3.6 | 257 | SKU-002353 |
| 2354 | Ultra Electronics Product Max | Electronics | $956.90 | 387 | ★ 2.8 | 348 | SKU-002354 |
| 2355 | Deluxe Books Product Max | Books | $366.85 | 306 | ★ 3.1 | 914 | SKU-002355 |
| 2356 | Deluxe Automotive Product Classic | Automotive | $308.63 | 370 | ★ 1.2 | 137 | SKU-002356 |
| 2357 | Ultra Home & Garden Product Lite | Home & Garden | $723.01 | 242 | ★ 1.7 | 706 | SKU-002357 |
| 2358 | Standard Office Supplies Product Mini | Office Supplies | $744.10 | 169 | ★ 3.0 | 343 | SKU-002358 |
| 2359 | Standard Office Supplies Product Max | Office Supplies | $111.13 | 418 | ★ 4.6 | 405 | SKU-002359 |
| 2360 | Pro Office Supplies Product Lite | Office Supplies | $708.21 | 289 | ★ 1.8 | 421 | SKU-002360 |
| 2362 | Professional Health & Beauty Product Special Edition | Health & Beauty | $472.96 | 429 | ★ 4.9 | 262 | SKU-002362 |
| 2363 | Super Clothing Product 2024 | Clothing | $557.23 | 341 | ★ 4.6 | 999 | SKU-002363 |
| 2364 | Ultra Toys & Games Product Classic | Toys & Games | $575.17 | 397 | ★ 1.9 | 767 | SKU-002364 |
// Efficient pagination with Skip and Take
public async Task<PaginatedResult<DemoProduct>> GetPaginatedProductsAsync(int page, int pageSize)
{
// Get total count (cached if possible)
var totalCount = await _context.DemoProducts.CountAsync(p => p.IsActive);
// Get page of results
var items = await _context.DemoProducts
.Where(p => p.IsActive)
.OrderBy(p => p.Id) // Important: Must have ORDER BY for consistent paging
.Skip((page - 1) * pageSize) // OFFSET in SQL
.Take(pageSize) // FETCH NEXT in SQL
.AsNoTracking() // No tracking needed for read-only
.ToListAsync();
return new PaginatedResult<DemoProduct>
{
Items = items,
TotalCount = totalCount,
Page = page,
PageSize = pageSize
};
}