Beispiel #1
0
 /// <summary>
 /// Names the specified actor identifier.
 /// </summary>
 /// <typeparam name="TActor">The type of the t actor.</typeparam>
 /// <param name="builder">The builder.</param>
 /// <param name="actorId">The actor identifier.</param>
 /// <returns>IEventStoreBuilder.</returns>
 /// <exception cref="System.ArgumentNullException">builder</exception>
 /// <exception cref="System.ArgumentNullException">actorId</exception>
 public static IEventStoreBuilder Name <TActor>(this IEventStoreBuilder builder, ActorId actorId)
     where TActor : Actor
 {
     _ = builder ?? throw new ArgumentNullException(nameof(builder));
     _ = actorId ?? throw new ArgumentNullException(nameof(actorId));
     return(builder.Name(StreamName <TActor>(actorId.GetId())));
 }
Beispiel #2
0
        static async Task InvokeActorMethodWithRemotingAsync(ActorId actorId)
        {
            Console.WriteLine($"Actor ID: {actorId.GetId()}");

            var actorType = "MyActor"; // Registered Actor Type in Actor Service

            // Create the local proxy by using the same interface that the service implements
            // By using this proxy, you can call strongly typed methods on the interface using Remoting.
            var proxy    = ActorProxy.Create <IMyActor>(actorId, actorType);
            var response = await proxy.SetDataAsync(new MyData()
            {
                PropertyA = "ValueA",
                PropertyB = "ValueB",
            });

            Console.WriteLine($"Response was: '{response}'");

            var savedData = await proxy.GetDataAsync();

            Console.WriteLine($"Saved data was: {savedData}");
            Console.WriteLine();
        }
Beispiel #3
0
        public void Get_Id(string id)
        {
            ActorId actorId = new ActorId(id);

            Assert.Equal(id, actorId.GetId());
        }