Ejemplo n.º 1
0
 public DataResultMessage(string id, IReadOnlyQueryResult payload)
     : base(
         MessageTypes.Subscription.Data,
         id,
         payload.ToDictionary())
 {
 }
Ejemplo n.º 2
0
        public Task SerializeAsync(
            IReadOnlyQueryResult result,
            Stream stream)
        {
            if (result is null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            if (stream is null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            IReadOnlyDictionary <string, object> dict = result.ToDictionary();
            string json = JsonConvert.SerializeObject(dict);

            byte[] buffer = _encoding.GetBytes(json);
            return(stream.WriteAsync(buffer, 0, buffer.Length));
        }
Ejemplo n.º 3
0
 public IReadOnlyDictionary <string, object> ToDictionary() =>
 _queryResult.ToDictionary();