/// <summary>
        /// Creates a proxy to communicate to the specified service using the remoted interface TServiceInterface that
        /// the service implements.
        /// <typeparam name="TServiceInterface">Interface that is being remoted</typeparam>
        /// <param name="serviceUri">Uri of the Service.</param>
        /// <param name="partitionKey">The Partition key that determines which service partition is responsible for handling requests from this service proxy</param>
        /// <param name="targetReplicaSelector">Determines which replica or instance of the service partition the client should connect to.</param>
        /// <param name="listenerName">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.
        /// </param>
        /// <returns>The proxy that implement the interface that is being remoted. The returned object also implement <see cref="Microsoft.ServiceFabric.Services.Remoting.Client.IServiceProxy"/> interface.</returns>
        /// </summary>
        public TServiceInterface CreateServiceProxy <TServiceInterface>(
            Uri serviceUri,
            ServicePartitionKey partitionKey            = null,
            TargetReplicaSelector targetReplicaSelector = TargetReplicaSelector.Default,
            string listenerName = null) where TServiceInterface : IService
        {
            var serviceInterfaceType           = typeof(TServiceInterface);
            var proxyGenerator                 = ServiceCodeBuilder.GetOrCreateProxyGenerator(serviceInterfaceType);
            var serviceRemotingPartitionClient = new ServiceRemotingPartitionClient(
                this.GetOrCreateServiceRemotingClientFactory(serviceInterfaceType),
                serviceUri,
                partitionKey,
                targetReplicaSelector,
                listenerName,
                this.retrySettings);

            return((TServiceInterface)(object)proxyGenerator.CreateServiceProxy(serviceRemotingPartitionClient));
        }
 internal void Initialize(ServiceProxyGeneratorWith generatorWith, ServiceRemotingPartitionClient client)
 {
     this.proxyGeneratorV1     = generatorWith;
     this.ServiceInterfaceType = this.proxyGeneratorV1.ProxyInterfaceType;
     this.partitionClient      = client;
 }
 internal void Initialize(ServiceProxyGeneratorWith generatorWith, ServiceRemotingPartitionClient client)
 {
     this.proxyGeneratorWith = generatorWith;
     this.partitionClient    = client;
 }