EricksonLopez.Pagination.Grpc
0.0.0-alpha.0
dotnet add package EricksonLopez.Pagination.Grpc --version 0.0.0-alpha.0
NuGet\Install-Package EricksonLopez.Pagination.Grpc -Version 0.0.0-alpha.0
<PackageReference Include="EricksonLopez.Pagination.Grpc" Version="0.0.0-alpha.0" />
<PackageVersion Include="EricksonLopez.Pagination.Grpc" Version="0.0.0-alpha.0" />
<PackageReference Include="EricksonLopez.Pagination.Grpc" />
paket add EricksonLopez.Pagination.Grpc --version 0.0.0-alpha.0
#r "nuget: EricksonLopez.Pagination.Grpc, 0.0.0-alpha.0"
#:package EricksonLopez.Pagination.Grpc@0.0.0-alpha.0
#addin nuget:?package=EricksonLopez.Pagination.Grpc&version=0.0.0-alpha.0&prerelease
#tool nuget:?package=EricksonLopez.Pagination.Grpc&version=0.0.0-alpha.0&prerelease
EricksonLopez.Pagination.Grpc
This package provides gRPC extensions and types for cursor-based pagination.
The Any Anti-Pattern in CursorPagedList<T>
In the EricksonLopez.Pagination.Grpc package, the CursorPagedList<T> relies on the Protobuf google.protobuf.Any type to represent polymorphic or generic item collections.
Why is Any used?
gRPC and Protocol Buffers do not natively support generics in the same way C# does. To send a list of items where the item type T is not known at the time the pagination message is defined, the Any type is used. Any allows mapping bytes to any message type, providing a generic wrapper.
Drawbacks
While this pattern enables generic pagination responses across different gRPC services, it introduces several drawbacks:
- Strong Typing Loss: Clients receiving the message must unpack the
Anytype explicitly, knowing the expected type beforehand. - Client Compatibility: Lightweight web clients (like gRPC-Web clients) or clients in languages without robust
Anysupport might struggle to deserialize the payloads efficiently. - Payload Overhead: The
Anytype includes a type URL string in every item, increasing the payload size compared to a strictly typed array.
Mitigation & Alternatives
If your gRPC protocol or client landscape requires strictly typed messages without the overhead or complexity of Any, you should:
- Define explicitly typed pagination responses in your
.protofiles (e.g.,UserPagedList,OrderPagedList). - Map the domain
CursorPagedList<T>into your strongly typed gRPC messages manually or via an object mapper.
Example of a strictly typed pagination response in Protobuf:
message UserPagedList {
repeated User items = 1;
int32 total_count = 2;
bool has_next_page = 3;
bool has_previous_page = 4;
string start_cursor = 5;
string end_cursor = 6;
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- EricksonLopez.Pagination.Abstractions (>= 0.0.0-alpha.0)
- Google.Protobuf (>= 3.35.1)
-
net8.0
- EricksonLopez.Pagination.Abstractions (>= 0.0.0-alpha.0)
- Google.Protobuf (>= 3.35.1)
-
net9.0
- EricksonLopez.Pagination.Abstractions (>= 0.0.0-alpha.0)
- Google.Protobuf (>= 3.35.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.0-alpha.0 | 68 | 8/25/2026 |