Пример #1
0
        public void InsertItemRecords(List <Item> items)
        {
            if (items != null && items.Any())
            {
                foreach (var item in items)
                {
                    if (item != null)
                    {
                        var record = new ItemRecord()
                        {
                            PartitionKey = item.Type,
                            RowKey       = item.Id.ToString().PadLeft(10, '0'),
                            Id           = item.Id,
                            Deleted      = item.Deleted,
                            Type         = item.Type,
                            By           = item.By,
                            Time         = item.UtcTime,
                            Text         = item.Text,
                            Dead         = item.Dead,
                            Parent       = item.Parent,
                            Poll         = item.Poll,
                            Kids         = item.Kids == null ? string.Empty : string.Join(",", item.Kids),
                            Url          = item.Url,
                            Score        = item.Score,
                            Title        = item.Title,
                            Parts        = item.Parts == null ? string.Empty : string.Join(",", item.Parts),
                            Descendants  = item.Descendants
                        };

                        _adapter.Insert(record, _tableName, record.PartitionKey, record.RowKey);
                    }
                }
            }
        }