/// <summary> /// Creates an instance of a template service from configuration. /// </summary> /// <param name="config">The configuration of the template service.</param> /// <returns>An instance of <see cref="TemplateService"/>.</returns> public static TemplateService CreateTemplateService(TemplateServiceConfigurationElement config) { if (config == null) throw new ArgumentNullException("config"); MarkupParser parser = null; if (!string.IsNullOrWhiteSpace(config.MarkupParser)) parser = CreateMarkupParser(config.MarkupParser); return CreateTemplateService(config.Language, config.StrictMode, parser); }
/// <summary> /// Creates an instance of <see cref="TemplateService"/> from the specified configuration. /// </summary> /// <param name="config">The template service configuration.</param> /// <returns>An instance of <see cref="TemplateService"/>.</returns> public static TemplateService CreateTemplateService(TemplateServiceConfigurationElement config) { if (config == null) { throw new ArgumentNullException("config"); } var service = TemplateServiceFactory.CreateTemplateService(config); AddNamespaces(service, config.Namespaces); if (!string.IsNullOrWhiteSpace(config.Activator)) { service.SetActivator(CreateInstance <IActivator>(config.Activator)); } return(service); }