Show / Hide Table of Contents

Class ServerServiceDefinitionExtensions

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

Inheritance
System.Object
ServerServiceDefinitionExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Grpc.Core.Interceptors
Assembly: Grpc.Core.dll
Syntax
public static class ServerServiceDefinitionExtensions

Methods

Intercept(ServerServiceDefinition, Interceptor)

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

Declaration
public static ServerServiceDefinition Intercept(this ServerServiceDefinition serverServiceDefinition, Interceptor interceptor)
Parameters
Type Name Description
ServerServiceDefinition serverServiceDefinition

The ServerServiceDefinition instance to register interceptors on.

Interceptor interceptor

The interceptor to intercept the incoming invocations with.

Returns
Type Description
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[])

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

Declaration
public static ServerServiceDefinition Intercept(this ServerServiceDefinition serverServiceDefinition, params Interceptor[] interceptors)
Parameters
Type Name Description
ServerServiceDefinition serverServiceDefinition

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
Type Description
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.

Back to top