public static class ServerServiceDefinitionExtensions : object
Extends the ServerServiceDefinition class to add methods used to register interceptors on the server side.
Namespace
Grpc.Core.InterceptorsAssembly
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.
Type | Name | Description |
---|---|---|
ServerServiceDefinition | serverServiceDefinition | The ServerServiceDefinition instance to register interceptors on. |
Interceptor | interceptor | The interceptor to intercept the incoming invocations with. |
Type | Description |
---|---|
ServerServiceDefinition |
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.
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. |
Type | Description |
---|---|
ServerServiceDefinition |
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.