using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MaksIT.Core.Sagas; /// /// Shared context to pass values between steps without tight coupling. /// public sealed class LocalSagaContext { private readonly Dictionary _bag = new(StringComparer.Ordinal); public T? Get(string key) { return _bag.TryGetValue(key, out var v) && v is T t ? t : default; } public LocalSagaContext Set(string key, T value) { _bag[key] = value; return this; } public bool Contains(string key) => _bag.ContainsKey(key); }