示例#1
0
        /// <summary>
        /// Inserts the record into a table storage table.
        /// </summary>
        /// <param name="record">The record.</param>
        /// <exception cref="ArgumentNullException">record</exception>
        public void Insert(T record)
        {
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            var entity = CreateEntity(record);

            _tableStore.Insert(entity);
        }
        public void get_records_by_partition_key_paged_using_maximum_page_size()
        {
            var tableStore = new TableStore <TestTableEntity>("recordsbypartmaxpage", ConnectionString, _tableStorageOptions);

            for (int i = 0; i < 11; i++)
            {
                var records = new List <TestTableEntity>();
                for (int j = 0; j < 100; j++)
                {
                    records.Add(new TestTableEntity($"{i}_{j}", "x"));
                }
                tableStore.Insert(records);
            }

            var results         = tableStore.GetByPartitionKeyPaged("x", pageSize: 1000);
            var nextPageResults =
                tableStore.GetByPartitionKeyPaged("x", pageSize: 1000,
                                                  continuationTokenJson: results.ContinuationToken);

            results.Items.Count.Should().Be(1000);
            nextPageResults.Items.Count.Should().Be(100);
            nextPageResults.IsFinalPage.Should().BeTrue();

            tableStore.DeleteTable();
        }