Esempio n. 1
0
        public T AggregateStream <T>(Guid streamId, int version = 0, DateTime?timestamp = null) where T : class, new()
        {
            var inner      = new EventQueryHandler(_selector, streamId, version, timestamp);
            var aggregator = _schema.Events.AggregateFor <T>();
            var handler    = new AggregationQueryHandler <T>(aggregator, inner, _session);

            var aggregate = _connection.Fetch(handler, null);

            var assignment = _schema.IdAssignmentFor <T>();

            assignment.Assign(aggregate, streamId);


            return(aggregate);
        }
Esempio n. 2
0
        /// <summary>
        /// Set the minimum sequence number for a Hilo sequence for a specific document type
        /// to the specified floor. Useful for migrating data between databases
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="floor"></param>
        public void ResetHiloSequenceFloor <T>(long floor)
        {
            // Make sure that the sequence is built for this one
            _schema.IdAssignmentFor <T>();
            var sequence = _schema.Sequences.SequenceFor(typeof(T));

            sequence.SetFloor(floor);
        }