Class ServerServiceDefinitionExtensions

public static class ServerServiceDefinitionExtensions : object

Extends the ServerServiceDefinition class to add methods used to register interceptors on the server side.

Inheritance

Object > ServerServiceDefinitionExtensions

Namespace

Grpc.Core.Interceptors

Assembly

Grpc.Core.dll

Methods

Intercept(ServerServiceDefinition, Interceptor)

public static ServerServiceDefinition Intercept(this ServerServiceDefinition serverServiceDefinition, Interceptor interceptor)

Returns a ServerServiceDefinition instance that intercepts incoming calls to the underlying service handler through the given interceptor.

Parameters
TypeNameDescription
ServerServiceDefinitionserverServiceDefinition

The ServerServiceDefinition instance to register interceptors on.

Interceptorinterceptor

The interceptor to intercept the incoming invocations with.

Returns
TypeDescription
ServerServiceDefinition
Remarks

Multiple interceptors can be added on top of each other by calling "serverServiceDefinition.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". Interceptors can be later added to an existing intercepted service definition, effectively building a chain like "serverServiceDefinition.Intercept(c).Intercept(b).Intercept(a)". Note that in this case, the last interceptor added will be the first to take control.

Intercept(ServerServiceDefinition, Interceptor[])

public static ServerServiceDefinition Intercept(this ServerServiceDefinition serverServiceDefinition, params Interceptor[] interceptors)

Returns a ServerServiceDefinition instance that intercepts incoming calls to the underlying service handler through the given interceptors.

Parameters
TypeNameDescription
ServerServiceDefinitionserverServiceDefinition

The ServerServiceDefinition instance to register interceptors on.

Interceptor[]interceptors

An array of interceptors to intercept the incoming invocations with. Control is passed to the interceptors in the order specified.

Returns
TypeDescription
ServerServiceDefinition
Remarks

Multiple interceptors can be added on top of each other by calling "serverServiceDefinition.Intercept(a, b, c)". The order of invocation will be "a", "b", and then "c". Interceptors can be later added to an existing intercepted service definition, effectively building a chain like "serverServiceDefinition.Intercept(c).Intercept(b).Intercept(a)". Note that in this case, the last interceptor added will be the first to take control.