Efficient pagination using OFFSET-FETCH on SQL Server.
| ID | Name | Category | Price | Stock | Rating | Reviews | SKU |
|---|---|---|---|---|---|---|---|
| 1009 | Elite Books Product Lite | Books | $452.43 | 458 | ★ 3.3 | 256 | SKU-001009 |
| 1010 | Mega Office Supplies Product Lite | Office Supplies | $655.10 | 376 | ★ 3.4 | 896 | SKU-001010 |
| 1012 | Pro Food & Grocery Product Classic | Food & Grocery | $960.45 | 146 | ★ 1.4 | 241 | SKU-001012 |
| 1013 | Standard Electronics Product XL | Electronics | $653.71 | 323 | ★ 1.8 | 572 | SKU-001013 |
| 1015 | Elite Toys & Games Product Max | Toys & Games | $661.83 | 85 | ★ 2.7 | 689 | SKU-001015 |
| 1016 | Economy Automotive Product Pro | Automotive | $569.78 | 33 | ★ 4.4 | 305 | SKU-001016 |
| 1017 | Elite Electronics Product Classic | Electronics | $573.84 | 455 | ★ 1.4 | 626 | SKU-001017 |
| 1018 | Ultra Home & Garden Product 2024 | Home & Garden | $365.65 | 86 | ★ 2.4 | 686 | SKU-001018 |
| 1019 | Premium Home & Garden Product Classic | Home & Garden | $863.39 | 467 | ★ 3.0 | 837 | SKU-001019 |
| 1020 | Elite Home & Garden Product Lite | Home & Garden | $464.07 | 7 | ★ 2.5 | 99 | SKU-001020 |
| 1021 | Deluxe Automotive Product 2024 | Automotive | $687.74 | 386 | ★ 3.2 | 235 | SKU-001021 |
| 1022 | Super Sports & Outdoors Product XL | Sports & Outdoors | $266.40 | 428 | ★ 3.0 | 97 | SKU-001022 |
| 1023 | Elite Toys & Games Product Special Edition | Toys & Games | $645.19 | 172 | ★ 2.6 | 970 | SKU-001023 |
| 1025 | Mega Home & Garden Product Advanced | Home & Garden | $240.08 | 209 | ★ 2.7 | 258 | SKU-001025 |
| 1027 | Elite Health & Beauty Product Plus | Health & Beauty | $37.70 | 104 | ★ 3.6 | 764 | SKU-001027 |
| 1028 | Ultra Food & Grocery Product XL | Food & Grocery | $107.16 | 437 | ★ 2.4 | 153 | SKU-001028 |
| 1029 | Deluxe Books Product Pro | Books | $199.95 | 425 | ★ 2.4 | 64 | SKU-001029 |
| 1032 | Premium Food & Grocery Product Mini | Food & Grocery | $147.32 | 29 | ★ 4.8 | 121 | SKU-001032 |
| 1034 | Economy Home & Garden Product Special Edition | Home & Garden | $703.11 | 387 | ★ 3.8 | 319 | SKU-001034 |
| 1035 | Super Health & Beauty Product Max | Health & Beauty | $307.22 | 300 | ★ 4.7 | 534 | SKU-001035 |
| 1036 | Deluxe Toys & Games Product Advanced | Toys & Games | $962.05 | 481 | ★ 1.8 | 604 | SKU-001036 |
| 1037 | Ultra Electronics Product Classic | Electronics | $499.36 | 50 | ★ 4.0 | 791 | SKU-001037 |
| 1038 | Elite Health & Beauty Product Mini | Health & Beauty | $890.33 | 237 | ★ 4.5 | 702 | SKU-001038 |
| 1039 | Professional Automotive Product Lite | Automotive | $985.93 | 322 | ★ 2.9 | 763 | SKU-001039 |
| 1040 | Pro Home & Garden Product Special Edition | Home & Garden | $834.34 | 27 | ★ 3.3 | 157 | SKU-001040 |
| 1041 | Premium Electronics Product Classic | Electronics | $820.99 | 50 | ★ 4.3 | 854 | SKU-001041 |
| 1042 | Elite Toys & Games Product Classic | Toys & Games | $645.04 | 167 | ★ 4.7 | 267 | SKU-001042 |
| 1043 | Elite Health & Beauty Product Special Edition | Health & Beauty | $182.90 | 133 | ★ 2.9 | 380 | SKU-001043 |
| 1044 | Standard Electronics Product Pro | Electronics | $480.76 | 42 | ★ 1.3 | 47 | SKU-001044 |
| 1045 | Premium Books Product Max | Books | $213.60 | 340 | ★ 2.2 | 667 | SKU-001045 |
| 1046 | Standard Home & Garden Product XL | Home & Garden | $505.25 | 439 | ★ 1.5 | 574 | SKU-001046 |
| 1047 | Standard Food & Grocery Product Max | Food & Grocery | $658.65 | 464 | ★ 1.3 | 766 | SKU-001047 |
| 1048 | Mega Automotive Product Lite | Automotive | $120.25 | 261 | ★ 2.5 | 265 | SKU-001048 |
| 1049 | Super Home & Garden Product Pro | Home & Garden | $757.73 | 362 | ★ 3.1 | 912 | SKU-001049 |
| 1050 | Premium Books Product Pro | Books | $824.57 | 126 | ★ 1.8 | 849 | SKU-001050 |
| 1051 | Economy Office Supplies Product Max | Office Supplies | $909.78 | 81 | ★ 2.8 | 356 | SKU-001051 |
| 1052 | Mega Office Supplies Product Plus | Office Supplies | $547.15 | 335 | ★ 2.4 | 230 | SKU-001052 |
| 1053 | Elite Electronics Product Mini | Electronics | $55.59 | 124 | ★ 4.6 | 662 | SKU-001053 |
| 1054 | Professional Automotive Product Lite | Automotive | $928.01 | 214 | ★ 1.7 | 517 | SKU-001054 |
| 1055 | Pro Health & Beauty Product Plus | Health & Beauty | $699.40 | 434 | ★ 1.5 | 808 | SKU-001055 |
| 1056 | Economy Electronics Product Advanced | Electronics | $926.45 | 411 | ★ 1.6 | 574 | SKU-001056 |
| 1057 | Professional Food & Grocery Product 2024 | Food & Grocery | $70.10 | 133 | ★ 1.0 | 298 | SKU-001057 |
| 1059 | Standard Books Product Special Edition | Books | $97.10 | 433 | ★ 1.0 | 901 | SKU-001059 |
| 1061 | Ultra Clothing Product Special Edition | Clothing | $718.70 | 269 | ★ 3.1 | 526 | SKU-001061 |
| 1062 | Professional Home & Garden Product XL | Home & Garden | $737.42 | 90 | ★ 3.5 | 695 | SKU-001062 |
| 1064 | Premium Toys & Games Product XL | Toys & Games | $224.38 | 379 | ★ 2.3 | 0 | SKU-001064 |
| 1065 | Mega Home & Garden Product Advanced | Home & Garden | $499.27 | 121 | ★ 2.3 | 586 | SKU-001065 |
| 1066 | Elite Clothing Product Mini | Clothing | $816.89 | 199 | ★ 3.4 | 607 | SKU-001066 |
| 1067 | Elite Sports & Outdoors Product Advanced | Sports & Outdoors | $585.66 | 384 | ★ 3.3 | 65 | SKU-001067 |
| 1068 | Economy Clothing Product Pro | Clothing | $928.88 | 310 | ★ 2.0 | 783 | SKU-001068 |
| 1069 | Ultra Sports & Outdoors Product Plus | Sports & Outdoors | $68.75 | 418 | ★ 4.2 | 927 | SKU-001069 |
| 1070 | Premium Health & Beauty Product Special Edition | Health & Beauty | $688.48 | 183 | ★ 2.4 | 253 | SKU-001070 |
| 1071 | Professional Automotive Product Advanced | Automotive | $352.53 | 391 | ★ 1.3 | 867 | SKU-001071 |
| 1072 | Elite Health & Beauty Product Classic | Health & Beauty | $114.98 | 290 | ★ 3.3 | 699 | SKU-001072 |
| 1074 | Deluxe Food & Grocery Product Special Edition | Food & Grocery | $740.81 | 432 | ★ 1.8 | 791 | SKU-001074 |
| 1075 | Standard Books Product 2024 | Books | $562.61 | 329 | ★ 1.6 | 984 | SKU-001075 |
| 1076 | Premium Office Supplies Product Classic | Office Supplies | $436.97 | 63 | ★ 5.0 | 140 | SKU-001076 |
| 1077 | Elite Books Product Lite | Books | $694.75 | 427 | ★ 4.5 | 418 | SKU-001077 |
| 1078 | Economy Automotive Product Lite | Automotive | $55.89 | 447 | ★ 2.1 | 514 | SKU-001078 |
| 1079 | Standard Automotive Product Mini | Automotive | $604.53 | 232 | ★ 1.9 | 864 | SKU-001079 |
| 1080 | Premium Office Supplies Product Lite | Office Supplies | $585.01 | 314 | ★ 3.9 | 79 | SKU-001080 |
| 1081 | Premium Office Supplies Product Lite | Office Supplies | $389.72 | 280 | ★ 3.2 | 786 | SKU-001081 |
| 1082 | Super Office Supplies Product 2024 | Office Supplies | $567.39 | 379 | ★ 3.1 | 406 | SKU-001082 |
| 1083 | Standard Clothing Product Special Edition | Clothing | $388.21 | 175 | ★ 1.4 | 135 | SKU-001083 |
| 1084 | Economy Clothing Product Special Edition | Clothing | $772.68 | 398 | ★ 1.2 | 224 | SKU-001084 |
| 1085 | Mega Health & Beauty Product Special Edition | Health & Beauty | $741.15 | 458 | ★ 3.6 | 386 | SKU-001085 |
| 1086 | Deluxe Clothing Product XL | Clothing | $962.66 | 133 | ★ 1.2 | 679 | SKU-001086 |
| 1087 | Ultra Books Product Max | Books | $522.00 | 353 | ★ 4.0 | 468 | SKU-001087 |
| 1088 | Pro Sports & Outdoors Product XL | Sports & Outdoors | $346.24 | 158 | ★ 1.0 | 524 | SKU-001088 |
| 1089 | Standard Automotive Product Pro | Automotive | $536.27 | 168 | ★ 2.4 | 899 | SKU-001089 |
| 1090 | Elite Electronics Product Lite | Electronics | $454.77 | 109 | ★ 4.3 | 416 | SKU-001090 |
| 1091 | Ultra Automotive Product 2024 | Automotive | $973.19 | 78 | ★ 4.2 | 246 | SKU-001091 |
| 1092 | Pro Electronics Product Plus | Electronics | $949.74 | 250 | ★ 3.3 | 901 | SKU-001092 |
| 1094 | Pro Food & Grocery Product XL | Food & Grocery | $236.50 | 49 | ★ 3.0 | 214 | SKU-001094 |
| 1096 | Super Toys & Games Product Plus | Toys & Games | $485.24 | 251 | ★ 1.1 | 906 | SKU-001096 |
| 1097 | Economy Toys & Games Product Classic | Toys & Games | $847.62 | 338 | ★ 3.7 | 387 | SKU-001097 |
| 1098 | Super Clothing Product Lite | Clothing | $653.28 | 54 | ★ 4.8 | 898 | SKU-001098 |
| 1099 | Ultra Automotive Product Classic | Automotive | $756.19 | 139 | ★ 4.3 | 738 | SKU-001099 |
| 1100 | Super Food & Grocery Product XL | Food & Grocery | $403.13 | 61 | ★ 2.9 | 337 | SKU-001100 |
| 1101 | Standard Office Supplies Product Special Edition | Office Supplies | $612.03 | 79 | ★ 3.8 | 648 | SKU-001101 |
| 1102 | Standard Toys & Games Product Lite | Toys & Games | $558.76 | 135 | ★ 2.6 | 664 | SKU-001102 |
| 1103 | Ultra Automotive Product Pro | Automotive | $499.08 | 20 | ★ 4.8 | 383 | SKU-001103 |
| 1104 | Super Home & Garden Product Pro | Home & Garden | $780.91 | 362 | ★ 4.7 | 136 | SKU-001104 |
| 1105 | Deluxe Office Supplies Product Plus | Office Supplies | $966.37 | 425 | ★ 1.0 | 614 | SKU-001105 |
| 1106 | Economy Home & Garden Product Plus | Home & Garden | $178.79 | 480 | ★ 3.7 | 690 | SKU-001106 |
| 1108 | Elite Books Product 2024 | Books | $447.91 | 74 | ★ 3.9 | 480 | SKU-001108 |
| 1109 | Premium Clothing Product Special Edition | Clothing | $197.08 | 339 | ★ 4.7 | 505 | SKU-001109 |
| 1110 | Deluxe Electronics Product Pro | Electronics | $683.61 | 87 | ★ 4.8 | 320 | SKU-001110 |
| 1111 | Pro Clothing Product XL | Clothing | $680.94 | 194 | ★ 4.4 | 44 | SKU-001111 |
| 1112 | Elite Food & Grocery Product Lite | Food & Grocery | $831.54 | 374 | ★ 3.8 | 31 | SKU-001112 |
| 1115 | Super Books Product Max | Books | $931.87 | 326 | ★ 4.7 | 954 | SKU-001115 |
| 1116 | Deluxe Office Supplies Product Special Edition | Office Supplies | $700.17 | 133 | ★ 1.9 | 453 | SKU-001116 |
| 1118 | Economy Electronics Product Max | Electronics | $492.68 | 184 | ★ 3.8 | 932 | SKU-001118 |
| 1119 | Deluxe Food & Grocery Product 2024 | Food & Grocery | $471.44 | 127 | ★ 4.4 | 822 | SKU-001119 |
| 1121 | Premium Clothing Product Special Edition | Clothing | $350.45 | 351 | ★ 2.4 | 811 | SKU-001121 |
| 1122 | Elite Food & Grocery Product XL | Food & Grocery | $486.01 | 246 | ★ 4.1 | 172 | SKU-001122 |
| 1123 | Elite Health & Beauty Product Special Edition | Health & Beauty | $626.48 | 457 | ★ 4.5 | 193 | SKU-001123 |
| 1124 | Professional Health & Beauty Product Max | Health & Beauty | $106.42 | 36 | ★ 2.5 | 194 | SKU-001124 |
| 1125 | Super Food & Grocery Product Plus | Food & Grocery | $939.23 | 122 | ★ 3.0 | 299 | SKU-001125 |
| 1126 | Ultra Home & Garden Product Special Edition | Home & Garden | $160.25 | 211 | ★ 1.8 | 588 | SKU-001126 |
// 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
};
}