From 987e0e2277317493add38d8eb632630b628bc924 Mon Sep 17 00:00:00 2001 From: gdlcf88 Date: Fri, 10 Jun 2022 23:24:21 +0800 Subject: [PATCH] Use a static state name --- .../EShop/Plugins/Inventories/DaprActors/InventoryActor.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/Inventories/DaprActors/src/EasyAbp.EShop.Plugins.Inventories.DaprActors/EasyAbp/EShop/Plugins/Inventories/DaprActors/InventoryActor.cs b/plugins/Inventories/DaprActors/src/EasyAbp.EShop.Plugins.Inventories.DaprActors/EasyAbp/EShop/Plugins/Inventories/DaprActors/InventoryActor.cs index a53e7c53..eb8e7345 100644 --- a/plugins/Inventories/DaprActors/src/EasyAbp.EShop.Plugins.Inventories.DaprActors/EasyAbp/EShop/Plugins/Inventories/DaprActors/InventoryActor.cs +++ b/plugins/Inventories/DaprActors/src/EasyAbp.EShop.Plugins.Inventories.DaprActors/EasyAbp/EShop/Plugins/Inventories/DaprActors/InventoryActor.cs @@ -6,18 +6,20 @@ namespace EasyAbp.EShop.Plugins.Inventories.DaprActors; public class InventoryActor : Actor, IInventoryActor { + public static string InventoryStateName { get; set; } = "i"; + public InventoryActor(ActorHost host) : base(host) { } protected override async Task OnActivateAsync() { - await StateManager.TryAddStateAsync(Id.GetId(), new InventoryStateModel()); + await StateManager.TryAddStateAsync(InventoryStateName, new InventoryStateModel()); } public virtual async Task GetInventoryStateAsync() { - return await StateManager.GetStateAsync(Id.GetId()); + return await StateManager.GetStateAsync(InventoryStateName); } public virtual async Task IncreaseInventoryAsync(int quantity, bool decreaseSold)