Skip to content

Class GrpcRegistrationExtensions ​

Namespace: Momentum.ServiceDefaults.Api
Assembly: Momentum.ServiceDefaults.Api.dll

Provides extension methods for automatic gRPC service registration.

csharp
[ExcludeFromCodeCoverage]
public static class GrpcRegistrationExtensions

Inheritance ​

object ← GrpcRegistrationExtensions

Inherited Members ​

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Methods ​

MapGrpcServices(IEndpointRouteBuilder, Assembly?) ​

Maps all gRPC services found in the specified assembly to endpoints.

csharp
public static void MapGrpcServices(this IEndpointRouteBuilder routeBuilder, Assembly? assembly = null)

Parameters ​

routeBuilder IEndpointRouteBuilder

The endpoint route builder to register services with.

assembly Assembly?

The assembly to scan for gRPC services. Defaults to the entry assembly.

Remarks ​

This method uses reflection to discover all gRPC service implementations and automatically registers them as endpoints. Services are identified by inheriting from a base class with the

.