Beispiel #1
0
 public void GetTests()
 {
     using(var connection = new NpgsqlConnection(_appSettings.ConnectionString))
       {
     var rs = connection.QueryAsync("");
       }
 }
        public static async Task<EventStream> GetLatestStreamCreated()
        {
            using (var connection = new NpgsqlConnection(GetConnectionStringBuilder()))
            {
                await connection
                    .OpenAsync()
                    .ConfigureAwait(false);

                var query = await connection
                    .QueryAsync<EventStream>(SelectLatestStreamSql)
                    .ConfigureAwait(false);

                return query.Any()
                    ? query.Single()
                    : default(EventStream);
            }
        }
        public static async Task<IEnumerable<StoredEvent>> GetStreamEvents(Guid streamId)
        {
            using (var connection = new NpgsqlConnection(GetConnectionStringBuilder()))
            {
                await connection
                    .OpenAsync()
                    .ConfigureAwait(false);

                var query = await connection
                    .QueryAsync<StoredEvent>(SelectStreamEventsSql)
                    .ConfigureAwait(false);

                return query.ToList();
            }
        }