Share via


ServiceProxyFactory.CreateServiceProxy<TServiceInterface> Method

Definition

Creates a proxy to communicate to the specified service using the remoted interface TServiceInterface that the service implements.

public TServiceInterface CreateServiceProxy<TServiceInterface> (Uri serviceUri, Microsoft.ServiceFabric.Services.Client.ServicePartitionKey partitionKey = default, Microsoft.ServiceFabric.Services.Communication.Client.TargetReplicaSelector targetReplicaSelector = Microsoft.ServiceFabric.Services.Communication.Client.TargetReplicaSelector.PrimaryReplica, string listenerName = default) where TServiceInterface : Microsoft.ServiceFabric.Services.Remoting.IService;
abstract member CreateServiceProxy : Uri * Microsoft.ServiceFabric.Services.Client.ServicePartitionKey * Microsoft.ServiceFabric.Services.Communication.Client.TargetReplicaSelector * string -> 'ServiceInterface (requires 'ServiceInterface :> Microsoft.ServiceFabric.Services.Remoting.IService)
override this.CreateServiceProxy : Uri * Microsoft.ServiceFabric.Services.Client.ServicePartitionKey * Microsoft.ServiceFabric.Services.Communication.Client.TargetReplicaSelector * string -> 'ServiceInterface (requires 'ServiceInterface :> Microsoft.ServiceFabric.Services.Remoting.IService)
Public Function CreateServiceProxy(Of TServiceInterface As IService) (serviceUri As Uri, Optional partitionKey As ServicePartitionKey = Nothing, Optional targetReplicaSelector As TargetReplicaSelector = Microsoft.ServiceFabric.Services.Communication.Client.TargetReplicaSelector.PrimaryReplica, Optional listenerName As String = Nothing) As TServiceInterface

Type Parameters

TServiceInterface

Interface that is being remoted

Parameters

serviceUri
Uri

Uri of the Service.

partitionKey
ServicePartitionKey

The Partition key that determines which service partition is responsible for handling requests from this service proxy

targetReplicaSelector
TargetReplicaSelector

Determines which replica or instance of the service partition the client should connect to.

listenerName
String

This parameter is Optional if the service has a single communication listener. The endpoints from the service are of the form {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}}. When the service exposes multiple endpoints, this parameter identifies which of those endpoints to use for the remoting communication.

Returns

TServiceInterface

The proxy that implement the interface that is being remoted. The returned object also implement IServiceProxy interface.

Implements

Applies to