コード例 #1
0
        public virtual List<string> TransformList(ITemplateProvider templateProvider, List<TemplateData> templateData)
        {
            CultureInfo threadCulture = Thread.CurrentThread.CurrentCulture;
            
            List<string> list = new List<string>();
            TemplateCache templateCache = new TemplateCache(templateProvider);

            foreach (TemplateData data in templateData)
            {
                string templateName = templateCache.GetOrCreateTemplate(data.Culture);
                Thread.CurrentThread.CurrentCulture = data.Culture ?? threadCulture;

                string content = null;
                if (data.ObjectModel != null)
                {
                    content = Transform(templateName, data.ObjectModel);
                }
                else
                {
                    var replaceModel = data.ReplaceModel ?? new Dictionary<string, string>();
                    content = Transform(templateName, replaceModel);
                }

                list.Add(content);
            }
                        
            Thread.CurrentThread.CurrentCulture = threadCulture;
            return list;
        }
コード例 #2
0
        public virtual List<string> TransformList(
            ITemplateProvider templateProvider, List<TemplateData> templateData)
        {
            List<string> list = new List<string>(); 
            TemplateCache templateCache = new TemplateCache(templateProvider);

            foreach (TemplateData data in templateData)
            {
                string template = templateCache.GetOrCreateTemplate(data.Culture);
                string content = Transform(template, data.ReplaceModel);
                list.Add(content);
            }

            return list;
        }