public IEvent Load(long index) { if (index < 0) { throw new InvalidOperationException("Event index must be >= 0!"); } if (_directory.ContainsKey(index) is false) { throw new InvalidOperationException($"Event with index {index} was not stored!"); } var text = _directory[index]; return(EventSerialization.Deserialize(text)); }
public IEvent Load(long index) { if (index < 0) { throw new InvalidOperationException("Event index must be >= 0!"); } var doc = _directory.FindOne(x => x.Id.Equals(index)); if (doc is null) { throw new InvalidOperationException($"Event with index {index} was not stored!"); } return(EventSerialization.Deserialize(doc.Text)); }
public void Store(long index, IEvent e) { var text = EventSerialization.Serialize(e); Store(index, text); }
public Event Load(long index) { var text = File.ReadAllText(FilepathFor(index)); return(EventSerialization.Deserialize(text)); }