コード例 #1
0
        public static async Task <WorkItemClassificationNode> CreateAreaAsync(this WorkItemTrackingHttpClient source, NodePath areaPath, CancellationToken cancellationToken)
        {
            //Get the parent area, if any
            if (areaPath.Parent != null)
            {
                var parentArea = await source.GetAreaAsync(areaPath.Parent, false, cancellationToken).ConfigureAwait(false);

                cancellationToken.ThrowIfCancellationRequested();

                if (parentArea == null)
                {
                    parentArea = await source.CreateAreaAsync(areaPath.Parent, cancellationToken).ConfigureAwait(false);
                }
            }
            ;

            var newArea = new WorkItemClassificationNode()
            {
                Name = areaPath.Name
            };

            newArea = await source.CreateOrUpdateClassificationNodeAsync(newArea, areaPath.Project, TreeStructureGroup.Areas, path : areaPath.Parent?.RelativePath, cancellationToken : cancellationToken).ConfigureAwait(false);

            Logger.Debug($"Created area '{areaPath}' with Id {newArea.Id}");

            return(newArea);
        }