/// <summary>
 /// Initializes a new instance of the <see cref="ActorProxyFactory"/> class using V1 remoting Client Factory.
 /// </summary>
 /// <param name="createServiceRemotingClientFactory">Factory method to create remoting communication client factory.</param>
 /// <param name="retrySettings">Retry settings for the remote object calls  made by proxy.</param>
 public ActorProxyFactory(
     Func <Services.Remoting.V1.IServiceRemotingCallbackClient,
           Services.Remoting.V1.Client.IServiceRemotingClientFactory>
     createServiceRemotingClientFactory,
     OperationRetrySettings retrySettings = null)
 {
     this.proxyFactoryV1 =
         new Remoting.V1.Client.ActorProxyFactory(createServiceRemotingClientFactory, retrySettings);
 }
        private IActorProxyFactory GetOrSetProxyFactory(Type actorInterfaceType)
        {
#if !DotNetCoreClr
            //Use provider to find the stack
            if (this.proxyFactoryV1 == null && this.proxyFactoryV2 == null)
            {
                var provider = this.GetProviderAttribute(actorInterfaceType);
                if (provider.RemotingClient.Equals(RemotingClient.V2Client))
                {
                    //We are overriding listenerName since using provider service can have multiple listener configured(Compat Mode).
                    this.overrideListenerName = true;
                    this.proxyFactoryV2       =
                        new Remoting.V2.Client.ActorProxyFactory(provider.CreateServiceRemotingClientFactoryV2);
                    return(this.proxyFactoryV2);
                }
                this.proxyFactoryV1 =
                    new Remoting.V1.Client.ActorProxyFactory(provider.CreateServiceRemotingClientFactory);
                return(this.proxyFactoryV1);
            }

            if (this.proxyFactoryV2 != null)
            {
                return(this.proxyFactoryV2);
            }
            return(this.proxyFactoryV1);
#else
            if (this.proxyFactoryV2 == null)
            {
                var provider = this.GetProviderAttribute(actorInterfaceType);
                this.overrideListenerName = true;
                this.proxyFactoryV2       =
                    new Remoting.V2.Client.ActorProxyFactory(provider.CreateServiceRemotingClientFactoryV2);
            }

            return(this.proxyFactoryV2);
#endif
        }