Exemplo n.º 1
0
        public static async Task Lesson(DataServiceRestClient client)
        {
            await client.CreateParts(new[] { Part, SubPart });

            await client.CreateCharacteristics(new[] { Characteristic, Child, SubChild });

            //Depth null will result in a recursive search
            var result = await client.GetCharacteristics(Part.Path, null);

            Console.WriteLine($"Depth null: {result.Count()} characteristics");

            //Depth 0 will return an empty list
            result = await client.GetCharacteristics(Part.Path, 0);

            Console.WriteLine($"Depth 0: {result.Count()} characteristics");

            //Depth 1 will return the direct child characteristics
            result = await client.GetCharacteristics(Part.Path, 1);

            Console.WriteLine($"Depth 1: {result.Count()} characteristics");

            //Depth 2 will return the direct children and their children, but not the children of subparts
            result = await client.GetCharacteristics(Part.Path, 2);

            Console.WriteLine($"Depth 2: {result.Count()} characteristics");

            //Use UpdateParts and UpdateCharacteristics to rename entities, and modify their attributes
            Part.Path = PathHelper.RoundtripString2PathInformation("P:/PartName2/");
            await client.UpdateParts(new[] { Part });
        }