Show / Hide Table of Contents

    Class CallInvokerExtensions

    Extends the CallInvoker class to provide the interceptor facility on the client side.

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

    Methods

    Intercept(CallInvoker, Interceptor)

    Returns a CallInvoker instance that intercepts the invoker with the given interceptor.

    Declaration
    public static CallInvoker Intercept(this CallInvoker invoker, Interceptor interceptor)
    Parameters
    Type Name Description
    CallInvoker invoker

    The underlying invoker to intercept.

    Interceptor interceptor

    The interceptor to intercept calls to the invoker with.

    Returns
    Type Description
    CallInvoker
    Remarks

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

    Intercept(CallInvoker, Interceptor[])

    Returns a CallInvoker instance that intercepts the invoker with the given interceptors.

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

    The channel to intercept.

    Interceptor[] interceptors

    An array of interceptors to intercept the calls to the invoker with. Control is passed to the interceptors in the order specified.

    Returns
    Type Description
    CallInvoker
    Remarks

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

    Intercept(CallInvoker, Func<Metadata, Metadata>)

    Returns a CallInvoker instance that intercepts the invoker with the given interceptor.

    Declaration
    public static CallInvoker Intercept(this CallInvoker invoker, Func<Metadata, Metadata> interceptor)
    Parameters
    Type Name Description
    CallInvoker invoker

    The underlying invoker to intercept.

    System.Func<Metadata, Metadata> interceptor

    An interceptor delegate that takes the request metadata to be sent with an outgoing call and returns a Metadata instance that will replace the existing invocation metadata.

    Returns
    Type Description
    CallInvoker
    Remarks

    Multiple interceptors can be added on top of each other by building a chain like "invoker.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 Generated by DocFX