public void Consume(MessageEdited message) { Trace.TraceInformation("DENORMALIZING MESSAGE EDITED EVENT {0}[{1}]...", message.Message, message.Id); MyMessageContext context = contextFactory(); storage.UpdateEntity <MessageView>(message.Id, v => { v.Context = context; v.Message = message.Message; v.UtcLastModified = message.UtcEdited; }); storage.UpdateSingleton <MessageIndex>(i => { i.Messages[message.Id] = message.Message; }); }
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.UpdateSingleton<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>(); }
public void Consume(AddLogin command) { _storage.UpdateSingleton <LoginIndex>(li => li.AddOrThrow(command.Username)); _repository.Append(_context().AggregateId, aar => aar.AddLogin(command.Username, command.Password)); }