Configuration Section Designer示例

Configuration Section Designer是一个图型化设计.net的配置块和自动生成需要代码和schema定义的codeplex上的一个开源项目。它是vs的一个插件,需要Microsoft Visual Studio 2008 Standard Edition or better的版本.

http://www.codeplex.com/csd下载最新的安装文件,目前最新的是1.1.1版本。安装完后会在vs2008中多一个工程模板Configuration Section Project,你也可以在现有的工程中添加一个ConfigurationSectionDesigner项,效果是一样。

这是一个基于微软领域特定语言(DSL)工具 - Visual Studio DSL Tool设计的项目,关于DSL可以从以下站点获得相关知识。

  • Visual Studio Extensibility
  • DSL Tools
  • Visual Studio Domain Specific Language tools
  • 作者没有提供示例程序,我琢磨了一会写了个,研究的不深,仅供参考。

    一、新建一个控制台程序

    二、添加ConfigurationSectionDesigner子项

    newitem

    三、生成的解决方案如下,红框中的4个文件是ConfigurationSectionDesigner生成的。

    project

  • ConfigurationSection.csd: 图型设计文件.
  • ConfigurationSectionCode.tt: a text template code generator that generates the C# code for the configuration section.
  • ConfigurationSectionSample.tt: generates a sample configuration file.
  • ConfigurationSectionSchema.tt: generates the XSD schema representing the configuration section.
  • 三、通过从工具箱中拖拽Configuration Sections, Configuration Elements and Configuration Element Collections完成中间的图型设计的

    me

    四、读取配置文件

    result

     

    Demo下载



    shore 2008-03-22 21:58 发表评论
    posted on 2008-03-22 21:58  蝈蝈  阅读(1059)  评论(0编辑  收藏  举报