EricksonLopez.Pagination.Grpc 0.0.0-alpha.0

This is a prerelease version of EricksonLopez.Pagination.Grpc.
dotnet add package EricksonLopez.Pagination.Grpc --version 0.0.0-alpha.0
                    
NuGet\Install-Package EricksonLopez.Pagination.Grpc -Version 0.0.0-alpha.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EricksonLopez.Pagination.Grpc" Version="0.0.0-alpha.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EricksonLopez.Pagination.Grpc" Version="0.0.0-alpha.0" />
                    
Directory.Packages.props
<PackageReference Include="EricksonLopez.Pagination.Grpc" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EricksonLopez.Pagination.Grpc --version 0.0.0-alpha.0
                    
#r "nuget: EricksonLopez.Pagination.Grpc, 0.0.0-alpha.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EricksonLopez.Pagination.Grpc@0.0.0-alpha.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EricksonLopez.Pagination.Grpc&version=0.0.0-alpha.0&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=EricksonLopez.Pagination.Grpc&version=0.0.0-alpha.0&prerelease
                    
Install as a Cake Tool

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 Any type explicitly, knowing the expected type beforehand.
  • Client Compatibility: Lightweight web clients (like gRPC-Web clients) or clients in languages without robust Any support might struggle to deserialize the payloads efficiently.
  • Payload Overhead: The Any type 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:

  1. Define explicitly typed pagination responses in your .proto files (e.g., UserPagedList, OrderPagedList).
  2. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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