我有一个使用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");
如何使用WcfActorRemotingClientFactory
或WCF实现相同的目标?
var wcfRemotingClient = new WcfActorRemotingClientFactory(WcfUtility.CreateTcpClientBinding(), null,
servicePartitionResolver: partitionResolver);
任何针对Actor的WCF客户端代码的代码片段?