public static string ResolveAllUsings(this ITemplate template, ISoftwareFactoryExecutionContext context, params string[] namespacesToIgnore) { var usings = template .GetAllTemplateDependencies() .SelectMany(context.FindTemplateInstances <ITemplate>) .Where(ti => ti != null && ti.GetMetadata().CustomMetadata.ContainsKey("Namespace")) .ToList() .Select(x => x.GetMetadata().CustomMetadata["Namespace"]) .Union(template.GetAllDeclareUsing()) .Where(x => !string.IsNullOrWhiteSpace(x)) .Except(namespacesToIgnore) .Distinct() .ToArray(); foreach (var @using in usings.Where(x => x != FixUsing(x))) { Logging.Log.Warning($"When resolving usings for Template Id [{template.Id}] file [{template.GetMetadata().FileName}], " + $"a using arrived with with the format [{@using}], but should have been in the format " + $"[{FixUsing(@using)}]. The module and/or decorator author should update this module."); } usings = usings .Select(x => $"using {FixUsing(x)};") .Distinct() .ToArray(); return(usings.Any() ? usings.Aggregate((x, y) => x + Environment.NewLine + y) : string.Empty); }
public static ITypeSource Create(ISoftwareFactoryExecutionContext context, string templateId, ICollectionFormatter collectionFormatter) { return(ClassTypeSource.Create(context, templateId).WithCollectionFormatter(collectionFormatter)); }
public static ITypeSource Create(ISoftwareFactoryExecutionContext context, string templateId, Func <string, string> collectionFormatter) { return(Create(context, templateId, new CollectionFormatter(collectionFormatter))); }
public static ITypeSource Create(ISoftwareFactoryExecutionContext context, string templateId) { return(Create(context, templateId, (ICollectionFormatter)null)); }
public static IEnumerable <TTemplate> FindTemplateInstances <TTemplate>(this ISoftwareFactoryExecutionContext context, ITemplateDependency templateDependency) where TTemplate : class { return(context.FindTemplateInstances(templateDependency.TemplateId, templateDependency.IsMatch).Cast <TTemplate>()); }
public static IOutputTarget FindOutputTargetWithTemplate(this ISoftwareFactoryExecutionContext executionContext, string templateId, IMetadataModel hasModel) { return(FindOutputTargetWithTemplate(executionContext, TemplateDependency.OnModel(templateId, hasModel))); }
public static IOutputTarget FindOutputTargetWithTemplate(this ISoftwareFactoryExecutionContext executionContext, ITemplateDependency templateDependency) { return(executionContext.FindOutputTargetWithTemplate(templateDependency.TemplateId, templateDependency.IsMatch)); }
public static TTemplate FindTemplateInstance <TTemplate>(this ISoftwareFactoryExecutionContext executionContext, string templateId) where TTemplate : class { return((TTemplate)executionContext.FindTemplateInstance(TemplateDependency.OnTemplate(templateId)) as TTemplate); }
public static TTemplate FindTemplateInstance <TTemplate>(this ISoftwareFactoryExecutionContext executionContext, ITemplateDependency templateDependency) where TTemplate : class { return((TTemplate)executionContext.FindTemplateInstance(templateDependency.TemplateId, templateDependency.IsMatch)); }
public static TTemplate FindTemplateInstance <TTemplate>(this ISoftwareFactoryExecutionContext executionContext, string templateId, object model) where TTemplate : class { return((TTemplate)executionContext.FindTemplateInstance(templateId, model) as TTemplate); }
//public static ITemplate FindTemplateInstance(this IApplication executionContext, string templateId, string className) //{ // return executionContext.FindTemplateInstance(templateId, TemplateDependency.OnClassName(templateId, className)); //} public static ITemplate FindTemplateInstance(this ISoftwareFactoryExecutionContext executionContext, ITemplateDependency templateDependency) { return(executionContext.FindTemplateInstance(templateDependency.TemplateId, templateDependency.IsMatch)); }
public static ITemplate FindTemplateInstance(this ISoftwareFactoryExecutionContext executionContext, string templateId, object model) { return(FindTemplateInstance(executionContext, TemplateDependency.OnModel(templateId, model))); }
public static ClassTypeSource Create(ISoftwareFactoryExecutionContext context, string templateId) { return(new ClassTypeSource(context, templateId)); }
internal ClassTypeSource(ISoftwareFactoryExecutionContext context, string templateId, ClassTypeSourceOptions options = null) { _context = context; _templateId = templateId; _options = options ?? new ClassTypeSourceOptions(); }