Ejemplo n.º 1
0
        public static ICloudTableEntityRangeQuery PrepareEntityRangeQueryByPartition(
            this ICloudTable table,
            string partitionKey,
            string[] properties)
        {
            Require.NotNull(table, "table");
            Require.NotNull(partitionKey, "partitionKey");

            return(table.PrepareEntityFilterRangeQuery(
                       "PartitionKey eq '{0}'".FormatString(partitionKey),
                       properties));
        }
Ejemplo n.º 2
0
        public static ICloudTableEntityRangeQuery PrepareEntityRangeQueryByRows(
            this ICloudTable table,
            string partitionKey,
            string fromRowKey,
            string toRowKey,
            string[] properties)
        {
            Require.NotNull(table, "table");
            Require.NotNull(fromRowKey, "fromRowKey");
            Require.NotNull(toRowKey, "toRowKey");

            return(table.PrepareEntityFilterRangeQuery(
                       "(PartitionKey eq '{0}') and (RowKey ge '{1}' and RowKey le '{2}')".FormatString(
                           partitionKey,
                           fromRowKey,
                           toRowKey),
                       properties));
        }
Ejemplo n.º 3
0
        public async Task <FetchEventsResult> FetchStreamEvents(string stream, EventStreamHeader header, StreamVersion fromVersion, int sliceSize)
        {
            // fromVersion already in slice
            var isFetchingCompleted = false;
            var nextSliceVersion    = fromVersion.Increment(sliceSize - 1);

            if (nextSliceVersion >= header.Version)
            {
                nextSliceVersion    = header.Version;
                isFetchingCompleted = true;
            }

            const string queryTemplate =
                "((PartitionKey eq '{0}') and (RowKey eq 'HEAD')) or " +
                "((PartitionKey eq '{0}') and (RowKey ge '{1}' and RowKey le '{2}'))";

            var query = m_table.PrepareEntityFilterRangeQuery(
                queryTemplate.FormatString(
                    stream,
                    fromVersion.ToString(),
                    nextSliceVersion.ToString()));

            var queryResult = await query.ExecuteAsync();

            var events = new SortedList <StreamVersion, JournaledEvent>(sliceSize);

            foreach (var properties in queryResult)
            {
                var rowKey = (string)properties[KnownProperties.RowKey];
                if (!rowKey.EqualsCi("HEAD"))
                {
                    events.Add(StreamVersion.Parse((string)properties[KnownProperties.RowKey]), JournaledEvent.Create(properties));
                }
            }

            return(new FetchEventsResult(isFetchingCompleted, events));
        }
Ejemplo n.º 4
0
        public static ICloudTableEntityRangeQuery PrepareEntityFilterRangeQuery(this ICloudTable table, string filter)
        {
            Require.NotNull(table, "table");

            return(table.PrepareEntityFilterRangeQuery(filter, EmptyArray.Get <string>()));
        }