Inheritance: Microsoft.WindowsAzure.Storage.Table.TableEntity
Esempio n. 1
0
        public static StoryTableEntity ToStoryTableEntity(IStory story)
        {
            if (story == null)
            {
                return null;
            }

            var storyTableEntity = new StoryTableEntity()
            {
                Name = story.Name,
                Elapsed = story.Elapsed,
                StartDateTime = story.StartDateTime,
                InstanceId = story.InstanceId,
                Json = story.Serialize()
            };

            storyTableEntity.UpdateKeys(story);

            return storyTableEntity;
        }
Esempio n. 2
0
        public static StoryTableEntity ToStoryTableEntity(IStory story)
        {
            if (story == null)
            {
                return(null);
            }

            var storyTableEntity = new StoryTableEntity()
            {
                Name          = story.Name,
                Elapsed       = story.Elapsed,
                StartDateTime = story.StartDateTime,
                InstanceId    = story.InstanceId,
                Json          = story.Serialize()
            };

            storyTableEntity.UpdateKeys(story);

            return(storyTableEntity);
        }
        private void PersistStoriesAsync(IList <IStory> stories)
        {
            var tableBatchOperation = new TableBatchOperation();

            foreach (var story in stories)
            {
                tableBatchOperation.Add(TableOperation.Insert(StoryTableEntity.ToStoryTableEntity(story)));
            }

            try
            {
                Retrier.Retry <object>(() =>
                {
                    this.storiesTable.ExecuteBatch(tableBatchOperation);
                    return(null);
                });
            }
            catch (StorageException)
            {
            }
        }