Class ClientBase<T>
Generic base class for client-side stubs.
Inherited Members
Namespace: Grpc.Core
Assembly: Grpc.Core.dll
Syntax
public abstract class ClientBase<T> : ClientBase where T : ClientBase<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
ClientBase()
Initializes a new instance of ClientBase
class that
throws NotImplementedException
upon invocation of any RPC.
This constructor is only provided to allow creation of test doubles
for client classes (e.g. mocking requires a parameterless constructor).
Declaration
protected ClientBase()
ClientBase(CallInvoker)
Initializes a new instance of ClientBase
class.
Declaration
public ClientBase(CallInvoker callInvoker)
Parameters
Type | Name | Description |
---|---|---|
CallInvoker | callInvoker | The |
ClientBase(Channel)
Initializes a new instance of ClientBase
class.
Declaration
public ClientBase(Channel channel)
Parameters
Type | Name | Description |
---|---|---|
Channel | channel | The channel to use for remote call invocation. |
ClientBase(ClientBase.ClientBaseConfiguration)
Initializes a new instance of ClientBase
class.
Declaration
protected ClientBase(ClientBase.ClientBaseConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
ClientBase.ClientBaseConfiguration | configuration | The configuration. |
Methods
NewInstance(ClientBase.ClientBaseConfiguration)
Creates a new instance of client from given ClientBaseConfiguration
.
Declaration
protected abstract T NewInstance(ClientBase.ClientBaseConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
ClientBase.ClientBaseConfiguration | configuration |
Returns
Type | Description |
---|---|
T |
WithHost(String)
Creates a new client that sets host field for calls explicitly.
gRPC supports multiple "hosts" being served by a single server.
By default (if a client was not created by calling this method),
host null
with the meaning "use default host" is used.
Declaration
public T WithHost(string host)
Parameters
Type | Name | Description |
---|---|---|
System.String | host |
Returns
Type | Description |
---|---|
T |