protected virtual void Attach(ITemplateObject templateObject, string parentFolderName = null) { if (templateObject.SkipAttach) { return; } if (string.IsNullOrEmpty(parentFolderName)) { ProjectsRepository.AddFromFile(templateObject.DestinationFullPath); return; } var parentFolder = SolutionFolderRepository.GetByName(parentFolderName); if (parentFolder == null) { throw new ArgumentException($"Scaffolding failed. Cannot find parent solution folder for file {templateObject.DestinationFullPath}."); } if (templateObject.Type == TemplateObjectType.Project) { ProjectsRepository.AddProjectFromFile(templateObject.DestinationFullPath, parentFolder); return; } ProjectsRepository.AddFromFile(templateObject.DestinationFullPath, parentFolder); }
protected virtual void AttachFile(ITemplateObject templateObject, IList <string> solutionLocation) { if (!solutionLocation.Any()) { throw new ArgumentException("Miss solution root object"); } if (solutionLocation.Count == 1) { ProjectsRepository.AddFromFile(templateObject.DestinationFullPath); return; } var parentFolder = SolutionFolderRepository.GetByName(solutionLocation[solutionLocation.Count - 1]); if (parentFolder == null) { throw new ArgumentException($"Scaffolding failed. Cannot find parent solution folder for file {templateObject.DestinationFullPath}."); } if (templateObject.Type == TemplateObjectType.Project) { ProjectsRepository.AddProjectFromFile(templateObject.DestinationFullPath, parentFolder); return; } ProjectsRepository.AddFromFile(templateObject.DestinationFullPath, parentFolder); }