Пример #1
0
        protected virtual void EnsureSolutionFolder(ITemplateObject templateObject, IList <string> solutionLocation)
        {
            if (solutionLocation.Count == 1)
            {
                SolutionFolderRepository.Create(templateObject.Name);
                return;
            }
            var parentFolder = SolutionFolderRepository.GetByName(solutionLocation[solutionLocation.Count - 1]);

            if (parentFolder == null)
            {
                throw new ArgumentException($"Scaffolding failed. Cannot find parent solution folder called {solutionLocation[solutionLocation.Count - 1]} for {templateObject.Name}.");
            }
            SolutionFolderRepository.Create(templateObject.Name, parentFolder);
        }
Пример #2
0
        protected virtual string AttachSolutionFolder(ITemplateObject templateObject, string parentFolderName = null)
        {
            if (templateObject.SkipAttach)
            {
                return(parentFolderName);
            }

            if (string.IsNullOrEmpty(parentFolderName))
            {
                return(SolutionFolderRepository.Create(templateObject.Name));
            }

            var parentFolder = SolutionFolderRepository.GetByName(parentFolderName);

            if (parentFolder == null)
            {
                throw new ArgumentException($"Scaffolding failed. Cannot find parent solution folder called {parentFolderName} for {templateObject.Name}.");
            }

            return(SolutionFolderRepository.Create(templateObject.Name, parentFolder));
        }