in code/src/CoreTemplateStudio/CoreTemplateStudio.Core/Gen/GenComposer.cs [158:208]
private static List<GenInfo> AddInCompositionTemplates(List<GenInfo> genQueue, UserSelection userSelection, bool newItemGeneration)
{
var compositionCatalog = GetCompositionCatalog(userSelection.Context.Platform).ToList();
var context = new QueryablePropertyDictionary
{
new QueryableProperty("projecttype", userSelection.Context.ProjectType),
new QueryableProperty("page", string.Join("|", userSelection.Pages.Select(p => p.TemplateId))),
new QueryableProperty("feature", string.Join("|", userSelection.Features.Select(p => p.TemplateId))),
new QueryableProperty("service", string.Join("|", userSelection.Services.Select(p => p.TemplateId))),
new QueryableProperty("testing", string.Join("|", userSelection.Testing.Select(p => p.TemplateId))),
};
if (!string.IsNullOrEmpty(userSelection.Context.FrontEndFramework))
{
context.Add(new QueryableProperty("frontendframework", userSelection.Context.FrontEndFramework));
}
if (!string.IsNullOrEmpty(userSelection.Context.BackEndFramework))
{
context.Add(new QueryableProperty("backendframework", userSelection.Context.BackEndFramework));
}
foreach (var property in userSelection.Context.PropertyBag)
{
context.Add(new QueryableProperty(property.Key.ToLowerInvariant(), property.Value));
}
var combinedQueue = new List<GenInfo>();
foreach (var genItem in genQueue)
{
combinedQueue.Add(genItem);
var compositionQueue = new List<GenInfo>();
context.AddOrUpdate(new QueryableProperty("ishomepage", (genItem.Name == userSelection.HomeName).ToString().ToLowerInvariant()));
foreach (var compositionItem in compositionCatalog)
{
if (compositionItem.Template.GetLanguage() == userSelection.Context.Language
&& compositionItem.Query.Match(genItem.Template, context))
{
AddTemplate(genItem, compositionQueue, compositionItem.Template, userSelection, newItemGeneration);
}
}
combinedQueue.AddRange(compositionQueue.OrderBy(g => g.Template.GetCompositionOrder()));
}
return combinedQueue;
}