public void Consume(GoMessage message) { var result = _storage.UpdateSingletonEnforcingNew <Entity>(s => s.Count += 1); if (result.Count == 5) { _sender.SendOne(new FinishMessage(), cb => cb.AddString("finish", "")); } else { _sender.SendOne(new GoMessage()); } }
void VerifyNonAtomic(NuclearStorage storage) { storage.AddOrUpdateEntity(1, new Entity()); storage.GetEntity <Entity>(1); storage.UpdateEntity <Entity>(1, e => e.Do()); storage.TryDeleteEntity <Entity>(1); storage.AddOrUpdateSingleton(() => new Entity(), e => e.Do()); storage.UpdateSingletonEnforcingNew <Entity>(e => e.Do()); storage.GetSingleton <Entity>(); storage.TryDeleteSingleton <Entity>(); storage.UpdateSingletonEnforcingNew <Entity>(e => e.Do()); //storage.UpdateOrAddEntity<Entity>(1, e => e.Do()); //storage.TryDelete<Entity>(1); //storage.SaveSingleton(new Entity()); //storage.GetSingleton<Entity>(); //storage.UpdateSingleton<Entity>(e => e.Do()); //storage.TryDeleteSingleton<Entity>(); }