5

我有一个使用 WCF 的演员服务:

[assembly: WcfActorRemotingProvider(RemotingListener = RemotingListener.V2Listener, RemotingClient = RemotingClient.V2Client)]
namespace Player.Interfaces
{
    /// <summary>
    /// This interface defines the methods exposed by an actor.
    /// Clients use this interface to interact with the actor that implements it.
    /// </summary>
    public interface IPlayer : IActor
    {
        Task<bool> JoinGameAsync(ActorId gameId, string playerName);
        Task<bool> MakeMoveAsync(ActorId gameId, int x, int y);
    }
}

使用 Service Remoting V2,我可以编写客户端代码并访问方法:

var player1 = ActorProxy.Create<IPlayer>(new ActorId("Player 1"), "fabric:/ActorWCFApplication");

如何使用WcfActorRemotingClientFactoryWCF 实现相同的效果?

var wcfRemotingClient = new WcfActorRemotingClientFactory(WcfUtility.CreateTcpClientBinding(), null, 
                                     servicePartitionResolver: partitionResolver);

Actor 的 WCF 客户端代码的任何代码片段?

4

0 回答 0