Beispiel #1
0
        /// <summary>
        /// Executes the query synchronously
        /// </summary>
        /// <returns>The response from HOBO</returns>
        public string ExecuteQuery()
        {
            var response = getWebRequest().GetResponse();
            var data     = new StreamReader(response.GetResponseStream() ?? throw new InvalidOperationException()).ReadToEnd();

            response.Close();
            QueryComplete?.Invoke(this, new QueryResponseArgs(data));
            return(data);
        }
Beispiel #2
0
        public async void Query(string bucket, string org)
        {
            string flux = $"from(bucket:\"{bucket}\") |> range(start: 0)";

            var queryApi = client.GetQueryApi();

            await queryApi.QueryAsync(flux, org, (cancellable, record) =>
            {
                QueryComplete?.Invoke(this, new QueryCompleteEventArgs(record));
            },
                                      exception =>
            {
                QueryException?.Invoke(this, new QueryExceptionEventArgs(exception));
            },
                                      () =>
            {
                QuerySuccess?.Invoke(this, new QuerySuccessEventArgs());
            });
        }
Beispiel #3
0
 /// <summary>
 ///     This method raises the QueryComplete event
 /// </summary>
 /// <param name="resultDataSet">DataSet returned by the query</param>
 /// <param name="executedCommand">This command lead to the provided result data set</param>
 /// <param name="entityName">Name of the last queried entity</param>
 protected virtual void RaiseOnQueryCompleteEvent(DataSet resultDataSet, IDbCommand executedCommand, string entityName) => QueryComplete?.Invoke(this, new QueryEventArgs(resultDataSet, executedCommand, entityName));
 /// <summary>
 ///     Static event sink that can be bound to data services and hand the
 ///     event on to other potential subscribers
 /// </summary>
 /// <param name="sender">Sender (data service)</param>
 /// <param name="e">Query Event Arguments</param>
 private static void OnQueryComplete(object sender, QueryEventArgs e) => QueryComplete?.Invoke(sender, e);