Exemplo n.º 1
0
        private static void copyBoardListToSeparateTable()
        {
            string pkFilter = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "boardlist1");

            TableQuery query = new TableQuery().Where(pkFilter);

            foreach (DynamicTableEntity entity in Warehouse.SiteTable.ExecuteQuery(query))
            {
                DynamicTableEntity new_entity = new DynamicTableEntity(entity.RowKey, "");
                if (entity.RowKey != "!info1")
                {
                    new_entity["boardname"] = entity["boardname"];
                    CreatorConverter.CopyEntity(entity, CreatorConverter.Status.Creator, new_entity, CreatorConverter.Status.Editor);

                    Warehouse.BoardListTable.Execute(TableOperation.Insert(new_entity));
                }
            }
        }
Exemplo n.º 2
0
        public static void CopyLetterRevision(DynamicTableEntity letter_entity, DynamicTableEntity revision_entity, int version)
        {
            CreatorConverter.CopyEntity(
                letter_entity,
                version == 0 ? CreatorConverter.Status.Creator : CreatorConverter.Status.LastEditor,
                revision_entity,
                CreatorConverter.Status.Editor);
            EntityProperty ep;

            string words = letter_entity["abstract"].StringValue;

            if (letter_entity.Properties.TryGetValue("words", out ep))
            {
                words += ep.StringValue;
            }

            revision_entity["words"]  = new EntityProperty(words);
            revision_entity["flags2"] = new EntityProperty(letter_entity.GetString("flags2", null));
        }
Exemplo n.º 3
0
        public static void CreateHistory(DynamicTableEntity src_entity, string partition_key, int version, params string[] properties_to_copy)
        {
            DynamicTableEntity dst_entity = new DynamicTableEntity(partition_key, SandId.MakeRevisionId(version));

            CreatorConverter.CopyEntity(src_entity,
                                        CreatorConverter.Status.Editor,
                                        dst_entity,
                                        CreatorConverter.Status.Editor);

            foreach (string property_name in properties_to_copy)
            {
                EntityProperty ep;
                if (src_entity.Properties.TryGetValue(property_name, out ep))
                {
                    dst_entity[property_name] = ep /*src_entity[property_name]*/;
                }
            }

            Warehouse.HistoryTable.Execute(TableOperation.Insert(dst_entity));
        }