T4Scaffolding.Cmdlets.GetDefaultScaffolderCmdlet.ProcessRecordCore C# (CSharp) Method

ProcessRecordCore() protected method

protected ProcessRecordCore ( ) : void
return void
        protected override void ProcessRecordCore()
        {
            var project = SolutionManager.GetProject(string.IsNullOrEmpty(Project) ? SolutionManager.DefaultProjectName : Project);
            if (project == null) {
                WriteError(string.Format("Could not find project '{0}'", Project ?? string.Empty));
                return;
            }

            // First get solution entries
            var results = (from entry in _configStore.Value.GetSolutionDefaultScaffolders()
                           where string.IsNullOrEmpty(Name) || entry.DefaultName.Equals(Name, StringComparison.OrdinalIgnoreCase)
                           select entry).ToDictionary(x => x.DefaultName, StringComparer.OrdinalIgnoreCase);

            // Then overlay the project entries
            var projectEntries = (from entry in _configStore.Value.GetProjectDefaultScaffolders(project)
                                  where string.IsNullOrEmpty(Name) || entry.DefaultName.Equals(Name, StringComparison.OrdinalIgnoreCase)
                                  select entry).ToDictionary(x => x.DefaultName, StringComparer.OrdinalIgnoreCase);
            foreach (var projectEntry in projectEntries) {
                results[projectEntry.Key] = projectEntry.Value;
            }

            WriteObject(results.Select(x => x.Value), true);
        }
    }