/// <summary> /// Finds a template generator supporting the specified template description /// </summary> /// <param name="description">The description.</param> /// <returns>A template generator supporting the specified description or null if not found.</returns> public static ITemplateGenerator FindTemplateGenerator(TemplateDescription description) { if (description == null) throw new ArgumentNullException("description"); lock (ThisLock) { // From most recently registered to older for (int i = Generators.Count - 1; i >=0 ; i--) { var generator = Generators[i]; if (generator.IsSupportingTemplate(description)) { return generator; } } } return null; }
/// <summary> /// Finds a template generator supporting the specified template description /// </summary> /// <param name="description">The description.</param> /// <returns>A template generator supporting the specified description or null if not found.</returns> public static ITemplateGenerator FindTemplateGenerator(TemplateDescription description) { if (description == null) { throw new ArgumentNullException("description"); } lock (ThisLock) { // From most recently registered to older for (int i = Generators.Count - 1; i >= 0; i--) { var generator = Generators[i]; if (generator.IsSupportingTemplate(description)) { return(generator); } } } return(null); }
/// <summary> /// Finds a template generator supporting the specified template description /// </summary> /// <param name="description">The description.</param> /// <returns>A template generator supporting the specified description or null if not found.</returns> public static ITemplateGenerator <TParameters> FindTemplateGenerator <TParameters>(TemplateDescription description) where TParameters : TemplateGeneratorParameters { if (description == null) { throw new ArgumentNullException(nameof(description)); } lock (ThisLock) { // From most recently registered to older for (int i = Generators.Count - 1; i >= 0; i--) { var generator = Generators[i] as ITemplateGenerator <TParameters>; if (generator != null && generator.IsSupportingTemplate(description)) { return(generator); } } } return(null); }
public abstract bool IsSupportingTemplate(TemplateDescription templateDescription);
public bool IsSupportingTemplate(TemplateDescription templateDescription) { return true; }
public override bool IsSupportingTemplate(TemplateDescription templateDescription) { if (templateDescription == null) throw new ArgumentNullException(nameof(templateDescription)); return templateDescription.Id == TemplateId; }