public abstract class ClientBase<T> : ClientBase where T : ClientBase<T>
Generic base class for client-side stubs.
Namespace
Grpc.CoreAssembly
Grpc.Core.Api.dll
Type Parameter |
|
---|---|
Name | Description |
T |
Constructors
ClientBase()
protected 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).
ClientBase(CallInvoker)
public ClientBase(CallInvoker callInvoker)
Initializes a new instance of ClientBase
class.
Parameter | |
---|---|
Name | Description |
callInvoker |
CallInvoker The |
ClientBase(ChannelBase)
public ClientBase(ChannelBase channel)
Initializes a new instance of ClientBase
class.
Parameter | |
---|---|
Name | Description |
channel |
ChannelBase The channel to use for remote call invocation. |
ClientBase(ClientBase.ClientBaseConfiguration)
protected ClientBase(ClientBase.ClientBaseConfiguration configuration)
Initializes a new instance of ClientBase
class.
Parameter | |
---|---|
Name | Description |
configuration |
ClientBase.ClientBaseConfiguration The configuration. |
Methods
NewInstance(ClientBase.ClientBaseConfiguration)
protected abstract T NewInstance(ClientBase.ClientBaseConfiguration configuration)
Creates a new instance of client from given ClientBaseConfiguration
.
Parameter | |
---|---|
Name | Description |
configuration |
ClientBase.ClientBaseConfiguration |
Returns | |
---|---|
Type | Description |
T |
WithHost(String)
public T WithHost(string host)
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.
Parameter | |
---|---|
Name | Description |
host |
String |
Returns | |
---|---|
Type | Description |
T |