Add an ActorProxy create method with a parameterized actor interface … (#285)

* Add an ActorProxy create method with a parameterized actor interface type.

* Verify that the interface implements IActor.

* fix error label
This commit is contained in:
Jérôme Piquot 2020-04-15 21:59:15 +02:00 committed by GitHub
parent 767fba5675
commit e797d2f941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -5,6 +5,7 @@
namespace Dapr.Actors.Client
{
using System;
using System.IO;
using System.Text;
using System.Text.Json;
@ -59,6 +60,25 @@ namespace Dapr.Actors.Client
return DefaultProxyFactory.CreateActorProxy<TActorInterface>(actorId, actorType);
}
/// <summary>
/// Creates a proxy to the actor object that implements an actor interface.
/// </summary>
/// <param name="actorId">The actor ID of the proxy actor object. Methods called on this proxy will result in requests
/// being sent to the actor with this ID.</param>
/// <param name="actorInterfaceType">
/// The actor interface type implemented by the remote actor object.
/// The returned proxy object will implement this interface.
/// </param>
/// <param name="actorType">
/// Type of actor implementation.
/// </param>
/// <returns>Proxy to the actor object.</returns>
public static object Create(ActorId actorId, Type actorInterfaceType, string actorType)
{
_ = actorInterfaceType as IActor ?? throw new ArgumentException("The interface must implement IActor.", nameof(actorInterfaceType));
return DefaultProxyFactory.CreateActorProxy(actorId, actorInterfaceType, actorType);
}
/// <summary>
/// Creates an Actor Proxy for making calls without Remoting.
/// </summary>