public void Play() { ExecuteDirectTableReader("EventStore", reader => { while (reader.Read()) { _eventPublisher.Publish(_toEventConverter.ToEvent(reader)); } return((object)null); }); }
private IEnumerable <Event> LoadEventsInternal(string aggrerateRootType, string aggregateRootId) { using (var connection = _connectionProvider.CreateAndOpenConnection()) { var cmd = connection.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = string.Format( "SELECT * FROM EventStore WHERE AggregateRootType = '{0}' AND AggregateRootId = '{1}' ORDER BY Id", aggrerateRootType, aggregateRootId); using (var dbReader = cmd.ExecuteReader()) { while (dbReader.Read()) { yield return(_toEventConverter.ToEvent(dbReader)); } } } }