当前位置: 首页>>代码示例>>C#>>正文


C# ExtendedProperties.AddProperty方法代码示例

本文整理汇总了C#中Commons.Collections.ExtendedProperties.AddProperty方法的典型用法代码示例。如果您正苦于以下问题:C# ExtendedProperties.AddProperty方法的具体用法?C# ExtendedProperties.AddProperty怎么用?C# ExtendedProperties.AddProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Commons.Collections.ExtendedProperties的用法示例。


在下文中一共展示了ExtendedProperties.AddProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NVelocityHelper

 static NVelocityHelper()
 {
     _velocity = new VelocityEngine();
     var props = new ExtendedProperties();
     props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, ConfigurationManager.AppSettings["TemplateFolder"]);
     _velocity.Init(props);
 }
开发者ID:lynchjames,项目名称:CallJSON,代码行数:7,代码来源:NVelocityHelper.cs

示例2: GetBasicProperties

 private static ExtendedProperties GetBasicProperties()
 {
     ExtendedProperties properties = new ExtendedProperties();
     properties.AddProperty("resource.loader", "assembly");
     properties.AddProperty("assembly.resource.loader.class",
         "NVelocity.Runtime.Resource.Loader.AssemblyResourceLoader, NVelocity");
     return properties;
 }
开发者ID:hatjhie,项目名称:NVelocity,代码行数:8,代码来源:AssemblyResourceLoaderTestCase.cs

示例3: TemplateHelper

 public TemplateHelper(string templatePath)
 {
     velocity = new VelocityEngine();
     ExtendedProperties props = new ExtendedProperties();
     props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, templatePath);
     props.AddProperty(RuntimeConstants.INPUT_ENCODING, "utf-8");
     velocity.Init(props);
     context = new VelocityContext();
 }
开发者ID:hhahh2011,项目名称:CH.EasyCode,代码行数:9,代码来源:TemplateHelper.cs

示例4: Apply

        public void  Apply(IEnumerable<ChangeScript> changeScripts)
        {
            string filename = string.Format(CultureInfo.InvariantCulture, "{0}_{1}.vm", this.syntax, this.GetTemplateQualifier());

            var model = new Hashtable();
            
            model.Add("scripts", changeScripts);
            model.Add("changeLogTableName", this.changeLogTableName);
            model.Add("delimiter", this.delimiter);
            model.Add("separator", this.delimiterType is RowDelimiter ? Environment.NewLine : string.Empty);

            try
            {
                ExtendedProperties props = new ExtendedProperties();

                var assemblyName = typeof(TemplateBasedApplier).Assembly.GetName().Name;

                ReplaceManagersWithDbDeployVersions(props, assemblyName);

                if (this.templateDirectory == null)
                {
                    props.AddProperty("resource.loader", "assembly");

                    // The ";" will be replaced by "," in the resource loader factory.
                    // This is because if we add a property with a comma in the value, it will add *two* values to the property.
                    props.AddProperty(
                        "assembly.resource.loader.class",
                        typeof(DbDeployAssemblyResourceLoader).FullName + "; " + assemblyName);

                    props.AddProperty("assembly.resource.loader.assembly", assemblyName);
                    filename = "Net.Sf.Dbdeploy.Resources." + filename;
                }
                else
                {
                    props.SetProperty("file.resource.loader.path", this.templateDirectory.FullName);
                }

                var templateEngine = new VelocityEngine(props);

                var context = new VelocityContext(model);

                Template template = templateEngine.GetTemplate(filename);

                template.Merge(context, this.writer);
            }
            catch (ResourceNotFoundException ex)
            {
                string locationMessage = templateDirectory == null 
                    ? string.Empty 
                    : (" at " + templateDirectory.FullName);

                throw new UsageException(
                    "Could not find template named " + filename + locationMessage + Environment.NewLine + "Check that you have got the name of the database syntax correct.",
                    ex);
            }
        }
开发者ID:peschuster,项目名称:dbdeploy.net,代码行数:56,代码来源:TemplateBasedApplier.cs

示例5: NVelocity

 static NVelocity()
 {
     filePath = Utils.GetMapPath(BaseConfigs.GetForumPath);
     engine = new VelocityEngine();
     props = new ExtendedProperties();
     props.AddProperty(RuntimeConstants.INPUT_ENCODING, "utf-8");
     props.AddProperty(RuntimeConstants.OUTPUT_ENCODING, "utf-8");
     props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, filePath);
     engine.Init(props);
 }
开发者ID:ChalmerLin,项目名称:dnt_v3.6.711,代码行数:10,代码来源:NVelocity.cs

示例6: NVelocityViewEngine

        /// <summary>
        /// Initializes a new instance of the <see cref="NVelocityViewEngine"/> class.
        /// </summary>
        /// <param name="assemblies">The assemblies.</param>
        /// <param name="extensionMethodTypes">The extension method types.</param>
        public NVelocityViewEngine(IEnumerable<Assembly> assemblies, params Type[] extensionMethodTypes)
        {
            var properties = new ExtendedProperties();
            properties.AddProperty("resource.loader", "parials");
            properties.AddProperty("parials.resource.loader.class", typeof(PartialFileResourceLoader).AssemblyQualifiedName.Replace(",", ";"));
            properties.AddProperty("parials.resource.loader.assembly", assemblies.Select(a => a.FullName).ToList());
            _engine = new VelocityEngine();
            _engine.Init(properties);

            _extensionMethods = extensionMethodTypes.SelectMany(type => type.GetMethods(BindingFlags.Public | BindingFlags.Static)).Select(method => new DynamicDispatchMethod(method)).ToArray();
        }
开发者ID:PaulStovell,项目名称:bindable,代码行数:16,代码来源:NVelocityViewEngine.cs

示例7: Init

        public void Init(string virtualDir)
        {
            //创建VelocityEngine实例对象
            velocity = new VelocityEngine();
            //使用设置初始化VelocityEngine
            ExtendedProperties props = new ExtendedProperties();
            props.AddProperty(RuntimeConstants.RESOURCE_LOADER, "file");
            props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, string.Format("{0}\\{1}", Root.TrimEnd('\\'), virtualDir));
            props.AddProperty(RuntimeConstants.INPUT_ENCODING, "utf-8");
            //  props.AddProperty(RuntimeConstants.OUTPUT_ENCODING, "utf-8");
            velocity.Init(props);

            //为模板变量赋值
            context = new VelocityContext();
        }
开发者ID:nkaluva,项目名称:helper,代码行数:15,代码来源:VelocityHelper.cs

示例8: Init

        /// <summary>
        /// 初始话NVelocity模块
        /// </summary>
        /// <param name="templatDir">模板文件夹路径</param>
        public void Init(string templatDir)
        {
            //创建VelocityEngine实例对象
            _velocity = new VelocityEngine();

            //使用设置初始化VelocityEngine
            var props = new ExtendedProperties();
            props.AddProperty(RuntimeConstants.RESOURCE_LOADER, "file");
            props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, templatDir);
            props.AddProperty(RuntimeConstants.INPUT_ENCODING, "utf-8");
            props.AddProperty(RuntimeConstants.OUTPUT_ENCODING, "utf-8");
            _velocity.Init(props);

            //为模板变量赋值
            _context = new VelocityContext();
        }
开发者ID:gaoninggn,项目名称:G1mist.CMS,代码行数:20,代码来源:VelocityHelper.cs

示例9: RenderTemplate

        public string RenderTemplate(string masterPage, string templateName, IDictionary<string, object> data)
        {
            if (string.IsNullOrEmpty(templateName))
            {
                throw new ArgumentException("The \"templateName\" parameter must be specified", "templateName");
            }

            var name = !string.IsNullOrEmpty(masterPage)
                 ? masterPage : templateName;

            var engine = new VelocityEngine();
            var props = new ExtendedProperties();
            props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, _templatesPath);
            engine.Init(props);
            var template = engine.GetTemplate(name);
            template.Encoding = Encoding.UTF8.BodyName;
            var context = new VelocityContext();

            var templateData = data ?? new Dictionary<string, object>();
            foreach (var key in templateData.Keys)
            {
                context.Put(key, templateData[key]);
            }

            if (!string.IsNullOrEmpty(masterPage))
            {
                context.Put("childContent", templateName);
            }

            using (var writer = new StringWriter())
            {
                engine.MergeTemplate(name, context, writer);
                return writer.GetStringBuilder().ToString();
            }
        }
开发者ID:leon737,项目名称:MvcBlanket,代码行数:35,代码来源:NVelocityTemplateRepository.cs

示例10: Test

        public void Test()
        {
            var vlte = new VelocityEngine();
            var props = new ExtendedProperties();
            props.AddProperty(RuntimeConstants.RESOURCE_LOADER, "file");
            props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, AppDomain.CurrentDomain.BaseDirectory);
            vlte.Init(props);

            var vlc = new VelocityContext();
            vlc.Put("test", "test");

            var vtp = vlte.GetTemplate("NVelocityTest.vm");
            var str = new StringWriter();
            vtp.Merge(vlc, str);
            Console.WriteLine(str.GetStringBuilder().ToString());
        }
开发者ID:starlightliu,项目名称:Starlightliu,代码行数:16,代码来源:NVelocityTest.cs

示例11: Format

        public static string Format(HttpContext context, string pattern, VelocityContext velocitycontext)
        {
                using (var writer = new StringWriter())
                {
                    try
                    {
                        if (!_isInitialized)
                        {
                            var props = new ExtendedProperties();
                            props.AddProperty("file.resource.loader.path",
                                              new ArrayList(new[]
                                                                {
                                                                    ".",
                                                                    Path.Combine(
                                                                        context.Server.MapPath(feed.HandlerBasePath),
                                                                        "Patterns")
                                                                }));
                            Velocity.Init(props);
                            _isInitialized = true;
                        }
                        //Load patterns
                        var template = Patterns.Get(pattern, () => LoadTemplate(pattern));

                        template.Merge(velocitycontext, writer);
                        return writer.GetStringBuilder().ToString();

                    }
                    catch (Exception)
                    {
                        //Format failed some way
                        return writer.GetStringBuilder().ToString();
                    }
                }
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:34,代码来源:Formatter.cs

示例12: Init

        public void Init()
        {
            _velocity = new VelocityEngine();

            var properties = new ExtendedProperties();
            properties.AddProperty(
                "resource.loader", 
                "assembly");
            properties.AddProperty(
                "assembly.resource.loader.class",
                "NVelocity.Runtime.Resource.Loader.AssemblyResourceLoader, NVelocity");
            properties.AddProperty(
                "assembly.resource.loader.assembly", 
                "CrystalQuartz.Web");

            _velocity.Init(properties);
        }
开发者ID:sdancer,项目名称:crystal-quartz,代码行数:17,代码来源:VelocityViewEngine.cs

示例13: NVelocityTemplateRepository

        public NVelocityTemplateRepository(string templateDirectory)
        {
            engine = new VelocityEngine();
            ExtendedProperties props = new ExtendedProperties();
            props.AddProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, templateDirectory);

            engine.Init(props);
        }
开发者ID:zhsh1241,项目名称:Sconit5_Shenya,代码行数:8,代码来源:NVelocityTemplateRepository.cs

示例14: Configure

        public virtual bool Configure()
        {
            _engine = new VelocityEngine();
            var props = new ExtendedProperties();
            props.AddProperty("file.resource.loader.path", TemplatePath);
            _engine.Init(props);

            return true;
        }
开发者ID:raghavrkapoor,项目名称:RagzRepo,代码行数:9,代码来源:NVelocityEmailProviderAbstract.cs

示例15: FillResponseTemplate

 public virtual string FillResponseTemplate(IDictionary<string, object> viewParams)
 {
     var engine = new VelocityEngine();
     var props = new ExtendedProperties();
     props.AddProperty(RuntimeConstants.RESOURCE_LOADER, "assembly");
     props.AddProperty("assembly.resource.loader.class",
                       "NVelocity.Runtime.Resource.Loader.AssemblyResourceLoader, NVelocity");
     props.AddProperty("assembly.resource.loader.assembly", GetType().Assembly.FullName);
     engine.Init(props);
     var vcontext = new VelocityContext();
     foreach (var k in viewParams) {
         vcontext.Put(k.Key, k.Value);
     }
     using (var writer = new StringWriter()) {
         engine.GetTemplate(ViewName).Merge(vcontext, writer);
         return writer.GetStringBuilder().ToString();
     }
 }
开发者ID:ruanzx,项目名称:mausch,代码行数:18,代码来源:Controller.cs


注:本文中的Commons.Collections.ExtendedProperties.AddProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。