示例#1
0
        public void Execute()
        {
            var v1 = new AssetClient(instanceUrl, accessToken);

            dynamic newStory = v1.Create(new {
                AssetType   = "Story",
                Scope       = "Scope:1015",
                Name        = $"Test Story Scope:1015 Update scalar attribute",
                Description = "I am not going to change this description after it is set"
            });

            dynamic retrievedStory = v1.Query(newStory.Oid).Select("Name", "Description").RetrieveFirst();

            retrievedStory.Name = $"{newStory.Name} - Name updated";

            v1.Update(retrievedStory);

            dynamic updatedRetrievedStory = v1.Query(retrievedStory.Oid).Select("Name", "Description").RetrieveFirst();

            WriteLine($"{newStory.Oid} original name: {newStory.Name}");
            WriteLine($"{retrievedStory.Oid} updated name: {updatedRetrievedStory.Name}");
            WriteLine($"{newStory.Oid} original description: {newStory.Description}");
            WriteLine($"{updatedRetrievedStory.Oid} non-updated description: {updatedRetrievedStory.Description}");

            WriteLine("Now we are going to try updating the original newStory object...");

            newStory.Name = "Test Story Scope:1015 updated on original newStory object!";
            v1.Update(newStory);

            dynamic newStoryFetchedAfterUpdate = v1.Query(newStory.Oid).Select("Name").RetrieveFirst();

            WriteLine($"{newStoryFetchedAfterUpdate.Oid} updated name is: {newStoryFetchedAfterUpdate.Name}");
        }
        public void Execute()
        {
            var v1 = new AssetClient(instanceUrl, accessToken);

            dynamic epic = v1.Create(
                ("AssetType", "Epic"),
                ("Scope", "Scope:0"),
                ("Name", "Epic with four Stories"),
                ("Subs", Assets(
                     Asset(
                         ("AssetType", "Story"),
                         ("Name", "Story in Epic")
                         ),
                     Asset(
                         ("AssetType", "Story"),
                         ("Name", "Another Story in Epic")
                         ),
                     Asset(
                         ("AssetType", "Story"),
                         ("Name", "Story in Epic")
                         ),
                     Asset(
                         ("AssetType", "Story"),
                         ("Name", "Another Story in Epic")
                         )
                     ))
                );

            IEnumerable <string> updated = v1.Update(
                From("Story")
                .Where(
                    Equal("Name", "Story in Epic", "Another Story in Epic"),
                    Equal("Scope", "Scope:0"),
                    Equal("Super", epic.Oid)
                    ), new
            {
                Description = "Updated via bulk API"
            });

            WriteLine("Updated the following Assets: " + string.Join(", ", updated));
        }