CustomerOrder.Actor.CustomerOrderActor.OnActivateAsync C# (CSharp) Méthode

OnActivateAsync() protected méthode

Initializes CustomerOrderActor state. Because an order actor will only be activated once in this scenario and never used again, when we initiate the actor's state we change the order's status to "Confirmed," and do not need to check if the actor's state was already set to this.
protected OnActivateAsync ( ) : Task
Résultat Task
        protected override async Task OnActivateAsync()
        {
            await InternalActivateAsync(this.ActorService.Context.CodePackageActivationContext, new ServiceProxyFactory());

            CustomerOrderStatus orderStatusResult = await this.GetOrderStatusAsync();

            if (orderStatusResult == CustomerOrderStatus.Unknown)
            {
                await this.StateManager.SetStateAsync<List<CustomerOrderItem>>(OrderItemListPropertyName, new List<CustomerOrderItem>());
                await this.StateManager.SetStateAsync<long>(RequestIdPropertyName, 0);
                await this.SetOrderStatusAsync(CustomerOrderStatus.New);
            }

            return;
        }