Esempio n. 1
0
        /// <summary>
        /// Exports a streamable as an observable of change list events. Produces events that represent either insertions or deletions.
        /// </summary>
        /// <typeparam name="TPayload">The type of object being streamed</typeparam>
        /// <param name="stream">An IStreamable object that is intended to be an output to the query.</param>
        /// <returns>An IObservable object of events for output data from the query.</returns>
        public static IObservable <TPayload> ToAtemporalObservable <TPayload>(
            this IStreamable <Empty, TPayload> stream)
        {
            Invariant.IsNotNull(stream, nameof(stream));

            return(stream.ToAtemporalObservable(null, Guid.NewGuid().ToString()));
        }
Esempio n. 2
0
        /// <summary>
        /// Registers an IStreamable object as an output of a query, with output as a list of change events.
        /// </summary>
        /// <typeparam name="TPayload">The type of object being streamed</typeparam>
        /// <param name="container">The query container to which an egress point is being added.</param>
        /// <param name="identifier">A string that can uniquely identify the point of egress in the query.</param>
        /// <param name="stream">An IStreamable object that is intended to be an output to the query.</param>
        /// <returns>An IObservable object of events for output data from the query.</returns>
        public static IObservable <TPayload> RegisterAtemporalOutput <TPayload>(
            this QueryContainer container,
            IStreamable <Empty, TPayload> stream,
            string identifier = null)
        {
            Invariant.IsNotNull(stream, nameof(stream));

            return(stream.ToAtemporalObservable(container, identifier ?? Guid.NewGuid().ToString()));
        }
Esempio n. 3
0
 /// <summary>
 /// Convert a stream (with a Empty key) to a simple enumerable of the payloads.
 /// </summary>
 /// <typeparam name="TPayload"></typeparam>
 /// <param name="source"></param>
 /// <returns></returns>
 public static IEnumerable <TPayload> ToPayloadEnumerable <TPayload>(this IStreamable <Empty, TPayload> source)
 {
     return(source.ToAtemporalObservable().ToEnumerable());
 }