liveBook · Manning

Stub

As explained in Building Web APIs with ASP.NET Core

A stub is generated proxy or base code that provides the callable interface for communicating with a remote service.

A stub is generated code that supplies a callable interface for communicating with a remote service. An interface description generates server base classes and client-side code, so application code can implement or call the declared operations instead of building the communication layer manually. section 10.3.4 section 10.4.3

A typical generated-stub workflow is:

  • Describe messages and service operations in a protocol buffer or other interface definition file. section 10.3.4 section 10.4.3
  • Configure the project so its compiler or IDL tool generates the required source code. section 10.3.4 section 10.4.3
  • Extend the generated server base class, connect it to application data, and register the service in the HTTP pipeline. section 10.3.4

Board-game lookup service

A grpc.proto definition declares GetBoardGame, accepting BoardGameRequest and returning BoardGameResponse. Generated code supplies the GrpcBase class; GrpcService extends it, queries EF Core for the requested board game, and returns the generated response type. The application enables gRPC with AddGrpc and MapGrpcService<GrpcService>(). section 10.3.4

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Explains generation and server integration, but defers detailed proto3 syntax and broader stub internals.
Examples
Uses grpc.proto, GetBoardGame, GrpcBase, GrpcService, and generated board-game request and response messages.
What it assumes
Assumes basic C# and project configuration, while introducing protobuf contracts, generated classes, and gRPC registration.
What you can do after
Build a remote service by defining its contract, generating stubs, extending the server base, and registering the implementation.
How it connects
Connects interface definition languages, protocol buffers, gRPC, Thrift, DTOs, and service registration.

Also explained in

Compare how 10 books explain stub →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.