Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DemoActor"/> class.
 /// </summary>
 /// <param name="service">Actor Service hosting the actor.</param>
 /// <param name="actorId">Actor Id.</param>
 public DemoActor(ActorService service
                  , ActorId actorId
                  , IHelloDaprWorld daprWorldService
                  , IRemindableWrapper remindableWrapper = null
                  , IActorStateManager actorStateManager = null
                  )
     : base(service, actorId)
 {
     this.daprWorldService  = daprWorldService ?? throw new ArgumentNullException(nameof(daprWorldService));
     this.remindableWrapper = remindableWrapper ?? new RemindableWrapper(RegisterReminderAsync);
     this.actorStateManager = actorStateManager ?? this.StateManager;;
 }
Exemple #2
0
        private DemoActor CreateTestDemoActor(IRemindableWrapper remindableWrapper, IActorStateManager actorStateManager, IHelloDaprWorld daprWorld = null)
        {
            var actorTypeInformation = ActorTypeInformation.Get(typeof(DemoActor));
            Func <ActorService, ActorId, DemoActor> actorFactory = (service, id) =>
                                                                   new DemoActor(service, id, daprWorld, remindableWrapper, actorStateManager);
            var actorService = new ActorService(actorTypeInformation, actorFactory);
            var demoActor    = actorFactory.Invoke(actorService, ActorId.CreateRandom());

            return(demoActor);
        }