Efficient pagination using OFFSET-FETCH on SQL Server.
| ID | Name | Category | Price | Stock | Rating | Reviews | SKU |
|---|---|---|---|---|---|---|---|
| 894 | Ultra Automotive Product Mini | Automotive | $315.96 | 56 | ★ 4.8 | 815 | SKU-000894 |
| 895 | Ultra Home & Garden Product Special Edition | Home & Garden | $408.76 | 126 | ★ 1.8 | 217 | SKU-000895 |
| 896 | Super Food & Grocery Product XL | Food & Grocery | $550.85 | 392 | ★ 2.0 | 332 | SKU-000896 |
| 897 | Standard Food & Grocery Product Classic | Food & Grocery | $601.19 | 335 | ★ 3.4 | 784 | SKU-000897 |
| 899 | Deluxe Electronics Product Lite | Electronics | $352.87 | 425 | ★ 4.9 | 402 | SKU-000899 |
| 900 | Premium Home & Garden Product Special Edition | Home & Garden | $258.80 | 57 | ★ 3.3 | 167 | SKU-000900 |
| 901 | Deluxe Electronics Product Max | Electronics | $399.46 | 422 | ★ 4.4 | 949 | SKU-000901 |
| 903 | Deluxe Toys & Games Product Lite | Toys & Games | $892.13 | 258 | ★ 2.1 | 693 | SKU-000903 |
| 904 | Super Home & Garden Product Classic | Home & Garden | $210.57 | 89 | ★ 1.3 | 110 | SKU-000904 |
| 905 | Premium Clothing Product Pro | Clothing | $462.39 | 241 | ★ 1.1 | 175 | SKU-000905 |
| 906 | Economy Home & Garden Product Mini | Home & Garden | $244.59 | 470 | ★ 2.3 | 636 | SKU-000906 |
| 907 | Elite Home & Garden Product Advanced | Home & Garden | $774.40 | 123 | ★ 3.8 | 875 | SKU-000907 |
| 908 | Professional Office Supplies Product Classic | Office Supplies | $729.55 | 180 | ★ 2.9 | 949 | SKU-000908 |
| 910 | Economy Home & Garden Product Max | Home & Garden | $822.57 | 339 | ★ 2.9 | 3 | SKU-000910 |
| 911 | Elite Health & Beauty Product XL | Health & Beauty | $854.05 | 316 | ★ 4.3 | 334 | SKU-000911 |
| 912 | Economy Electronics Product Mini | Electronics | $921.11 | 406 | ★ 2.0 | 665 | SKU-000912 |
| 913 | Standard Books Product 2024 | Books | $100.01 | 45 | ★ 1.5 | 424 | SKU-000913 |
| 915 | Elite Clothing Product Mini | Clothing | $56.66 | 319 | ★ 2.4 | 168 | SKU-000915 |
| 917 | Pro Electronics Product Max | Electronics | $15.74 | 187 | ★ 3.3 | 645 | SKU-000917 |
| 918 | Economy Toys & Games Product 2024 | Toys & Games | $475.64 | 187 | ★ 4.0 | 835 | SKU-000918 |
| 919 | Economy Electronics Product Lite | Electronics | $69.26 | 18 | ★ 1.7 | 56 | SKU-000919 |
| 921 | Professional Food & Grocery Product XL | Food & Grocery | $687.41 | 349 | ★ 3.8 | 148 | SKU-000921 |
| 922 | Deluxe Toys & Games Product Lite | Toys & Games | $20.83 | 152 | ★ 1.2 | 16 | SKU-000922 |
| 923 | Pro Food & Grocery Product Advanced | Food & Grocery | $784.13 | 312 | ★ 2.5 | 840 | SKU-000923 |
| 924 | Premium Health & Beauty Product 2024 | Health & Beauty | $150.93 | 3 | ★ 1.3 | 741 | SKU-000924 |
| 926 | Elite Toys & Games Product Classic | Toys & Games | $64.80 | 345 | ★ 4.5 | 104 | SKU-000926 |
| 927 | Economy Books Product Mini | Books | $341.15 | 160 | ★ 4.3 | 635 | SKU-000927 |
| 928 | Economy Electronics Product 2024 | Electronics | $615.56 | 95 | ★ 1.4 | 851 | SKU-000928 |
| 929 | Premium Automotive Product Classic | Automotive | $932.99 | 59 | ★ 2.0 | 321 | SKU-000929 |
| 930 | Pro Clothing Product Max | Clothing | $42.18 | 212 | ★ 4.7 | 347 | SKU-000930 |
| 932 | Professional Food & Grocery Product Mini | Food & Grocery | $939.41 | 439 | ★ 1.3 | 23 | SKU-000932 |
| 933 | Professional Electronics Product Classic | Electronics | $522.45 | 398 | ★ 3.8 | 806 | SKU-000933 |
| 935 | Mega Books Product Lite | Books | $650.88 | 418 | ★ 1.7 | 212 | SKU-000935 |
| 936 | Mega Books Product Plus | Books | $239.45 | 9 | ★ 3.2 | 357 | SKU-000936 |
| 937 | Mega Toys & Games Product Pro | Toys & Games | $889.19 | 440 | ★ 3.8 | 32 | SKU-000937 |
| 938 | Professional Home & Garden Product 2024 | Home & Garden | $330.39 | 163 | ★ 1.0 | 851 | SKU-000938 |
| 939 | Economy Automotive Product Mini | Automotive | $330.66 | 36 | ★ 4.8 | 967 | SKU-000939 |
| 940 | Pro Health & Beauty Product 2024 | Health & Beauty | $82.18 | 103 | ★ 2.5 | 960 | SKU-000940 |
| 941 | Economy Office Supplies Product Advanced | Office Supplies | $283.55 | 208 | ★ 3.2 | 363 | SKU-000941 |
| 942 | Mega Home & Garden Product Lite | Home & Garden | $585.28 | 214 | ★ 2.4 | 931 | SKU-000942 |
| 943 | Pro Clothing Product Plus | Clothing | $272.57 | 128 | ★ 4.4 | 419 | SKU-000943 |
| 944 | Super Books Product Plus | Books | $532.47 | 41 | ★ 5.0 | 653 | SKU-000944 |
| 945 | Professional Office Supplies Product 2024 | Office Supplies | $200.76 | 215 | ★ 4.5 | 463 | SKU-000945 |
| 946 | Super Food & Grocery Product Classic | Food & Grocery | $269.46 | 244 | ★ 4.4 | 928 | SKU-000946 |
| 947 | Elite Electronics Product Advanced | Electronics | $883.39 | 31 | ★ 2.3 | 742 | SKU-000947 |
| 948 | Professional Office Supplies Product Advanced | Office Supplies | $153.28 | 96 | ★ 2.9 | 508 | SKU-000948 |
| 949 | Standard Food & Grocery Product Plus | Food & Grocery | $765.52 | 56 | ★ 4.8 | 441 | SKU-000949 |
| 950 | Professional Home & Garden Product Lite | Home & Garden | $272.89 | 37 | ★ 5.0 | 679 | SKU-000950 |
| 951 | Deluxe Books Product Lite | Books | $738.94 | 341 | ★ 3.4 | 469 | SKU-000951 |
| 952 | Mega Books Product Mini | Books | $743.49 | 47 | ★ 2.5 | 929 | SKU-000952 |
| 953 | Ultra Books Product Mini | Books | $569.74 | 209 | ★ 2.7 | 483 | SKU-000953 |
| 954 | Economy Office Supplies Product Classic | Office Supplies | $514.38 | 121 | ★ 4.4 | 488 | SKU-000954 |
| 955 | Pro Clothing Product XL | Clothing | $720.20 | 85 | ★ 4.6 | 939 | SKU-000955 |
| 956 | Standard Food & Grocery Product Max | Food & Grocery | $436.98 | 54 | ★ 3.8 | 266 | SKU-000956 |
| 957 | Elite Food & Grocery Product Pro | Food & Grocery | $195.16 | 246 | ★ 2.2 | 539 | SKU-000957 |
| 958 | Economy Automotive Product Classic | Automotive | $552.14 | 356 | ★ 4.9 | 490 | SKU-000958 |
| 959 | Professional Office Supplies Product Mini | Office Supplies | $587.09 | 308 | ★ 1.7 | 764 | SKU-000959 |
| 960 | Mega Toys & Games Product Advanced | Toys & Games | $528.70 | 170 | ★ 2.1 | 142 | SKU-000960 |
| 961 | Ultra Sports & Outdoors Product Lite | Sports & Outdoors | $758.16 | 432 | ★ 3.4 | 314 | SKU-000961 |
| 962 | Mega Home & Garden Product XL | Home & Garden | $529.59 | 7 | ★ 3.9 | 862 | SKU-000962 |
| 963 | Ultra Automotive Product Special Edition | Automotive | $873.63 | 365 | ★ 4.7 | 20 | SKU-000963 |
| 964 | Deluxe Office Supplies Product Plus | Office Supplies | $928.90 | 460 | ★ 1.1 | 723 | SKU-000964 |
| 966 | Pro Books Product Lite | Books | $563.80 | 388 | ★ 4.1 | 818 | SKU-000966 |
| 967 | Economy Home & Garden Product Mini | Home & Garden | $582.50 | 220 | ★ 2.0 | 130 | SKU-000967 |
| 968 | Pro Clothing Product Plus | Clothing | $981.13 | 334 | ★ 3.5 | 393 | SKU-000968 |
| 969 | Pro Books Product Max | Books | $712.09 | 313 | ★ 3.5 | 100 | SKU-000969 |
| 971 | Pro Clothing Product Max | Clothing | $699.63 | 464 | ★ 1.2 | 428 | SKU-000971 |
| 972 | Professional Home & Garden Product Plus | Home & Garden | $456.36 | 43 | ★ 1.4 | 83 | SKU-000972 |
| 973 | Mega Sports & Outdoors Product Special Edition | Sports & Outdoors | $893.03 | 491 | ★ 4.2 | 196 | SKU-000973 |
| 974 | Standard Clothing Product 2024 | Clothing | $438.05 | 446 | ★ 3.3 | 368 | SKU-000974 |
| 975 | Premium Clothing Product Max | Clothing | $872.94 | 281 | ★ 3.4 | 809 | SKU-000975 |
| 976 | Super Sports & Outdoors Product Special Edition | Sports & Outdoors | $954.74 | 291 | ★ 2.4 | 487 | SKU-000976 |
| 977 | Elite Electronics Product Classic | Electronics | $673.63 | 185 | ★ 4.5 | 64 | SKU-000977 |
| 978 | Standard Toys & Games Product Pro | Toys & Games | $666.97 | 155 | ★ 4.9 | 93 | SKU-000978 |
| 980 | Standard Office Supplies Product Lite | Office Supplies | $201.67 | 376 | ★ 4.9 | 7 | SKU-000980 |
| 981 | Mega Health & Beauty Product Advanced | Health & Beauty | $124.65 | 263 | ★ 4.1 | 837 | SKU-000981 |
| 982 | Deluxe Food & Grocery Product Advanced | Food & Grocery | $313.53 | 350 | ★ 4.3 | 883 | SKU-000982 |
| 983 | Standard Home & Garden Product XL | Home & Garden | $882.82 | 197 | ★ 3.3 | 961 | SKU-000983 |
| 984 | Super Sports & Outdoors Product Pro | Sports & Outdoors | $164.50 | 489 | ★ 3.8 | 731 | SKU-000984 |
| 985 | Mega Food & Grocery Product Mini | Food & Grocery | $82.68 | 142 | ★ 4.9 | 934 | SKU-000985 |
| 987 | Deluxe Clothing Product 2024 | Clothing | $255.76 | 150 | ★ 4.2 | 169 | SKU-000987 |
| 988 | Premium Health & Beauty Product Mini | Health & Beauty | $26.01 | 321 | ★ 3.8 | 960 | SKU-000988 |
| 989 | Professional Office Supplies Product Max | Office Supplies | $80.55 | 218 | ★ 2.2 | 702 | SKU-000989 |
| 990 | Pro Automotive Product Special Edition | Automotive | $894.25 | 309 | ★ 1.6 | 798 | SKU-000990 |
| 991 | Professional Health & Beauty Product Mini | Health & Beauty | $659.15 | 92 | ★ 2.8 | 588 | SKU-000991 |
| 992 | Deluxe Electronics Product Lite | Electronics | $484.22 | 283 | ★ 1.1 | 27 | SKU-000992 |
| 993 | Premium Clothing Product Lite | Clothing | $581.44 | 139 | ★ 3.1 | 287 | SKU-000993 |
| 994 | Pro Office Supplies Product Lite | Office Supplies | $168.65 | 452 | ★ 1.7 | 190 | SKU-000994 |
| 995 | Economy Automotive Product Classic | Automotive | $13.12 | 434 | ★ 3.8 | 931 | SKU-000995 |
| 997 | Premium Automotive Product Lite | Automotive | $119.93 | 347 | ★ 3.3 | 107 | SKU-000997 |
| 998 | Professional Food & Grocery Product Plus | Food & Grocery | $581.31 | 316 | ★ 3.2 | 768 | SKU-000998 |
| 999 | Professional Food & Grocery Product Lite | Food & Grocery | $631.66 | 300 | ★ 4.7 | 524 | SKU-000999 |
| 1000 | Economy Food & Grocery Product Special Edition | Food & Grocery | $846.27 | 186 | ★ 4.3 | 980 | SKU-001000 |
| 1001 | Economy Office Supplies Product Special Edition | Office Supplies | $773.78 | 375 | ★ 1.9 | 572 | SKU-001001 |
| 1002 | Deluxe Health & Beauty Product Advanced | Health & Beauty | $957.81 | 368 | ★ 2.9 | 835 | SKU-001002 |
| 1003 | Economy Clothing Product Lite | Clothing | $113.78 | 410 | ★ 3.4 | 779 | SKU-001003 |
| 1004 | Economy Books Product Lite | Books | $596.95 | 411 | ★ 1.8 | 344 | SKU-001004 |
| 1005 | Economy Office Supplies Product Plus | Office Supplies | $319.10 | 261 | ★ 1.8 | 223 | SKU-001005 |
| 1007 | Super Home & Garden Product Plus | Home & Garden | $531.19 | 251 | ★ 2.0 | 572 | SKU-001007 |
| 1008 | Deluxe Office Supplies Product Classic | Office Supplies | $580.50 | 230 | ★ 4.2 | 418 | SKU-001008 |
// 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
};
}