【问题标题】:Providing intellisense/xsd validation to configsections向 configsections 提供智能感知/xsd 验证
【发布时间】:2010-09-24 23:17:00
【问题描述】:

在一个小型 c# 项目中,我正在尝试创建一个简单的自定义配置部分。 我按照CodeProject: Unraveling the Mysteries of .NET 2.0 Configuration 中的说明进行操作,一切运行良好……除了我没有在配置上获得 xsd 验证和智能感知这一事实。

我的配置如下所示。

<configuration>
 <configSections>
    <section name="pizza" type="TestConfig.Configuration.PizzaConfigurationSection, TestConfig.Configuration"/>
 </configSections>

 <pizza name="Margherita" timeToCook="00:10:00" price="15.12">
   <cook firstName="Nicola" lastName="Carrer" rank="7" />
   <toppings>
     <add name="Mozzarella" percentage="0.6" />
     <add name="Tomato sauce" percentage="0.28" />
     <add name="Oregano" percentage="0.02" />
     <add name="Mushrooms" percentage="0.1" />
   </toppings>
 </pizza>
</configuration>

在这篇文章 (XSDExtractor) 上,我找到了一个工具,它可以为配置部分创建一个 xsd 文件。它工作正常,即它为主要属性(例如“价格”)和单个元素(“厨师”)提供智能感知和验证。但是我无法使其适用于收藏品(“浇头”)。

我的问题:

  1. 是否有任何其他工具可以提供 xsd 生成 ConfigurationSection 类?
  2. 是否有人在具有集合属性的 ConfigurationSection 上成功运行 XSDExtractor?

非常感谢, 尼古拉

【问题讨论】:

    标签: c# configuration configsection


    【解决方案1】:

    我没有使用过 XSDExtractor,但我强烈推荐的一种工具是 Configuration Section Designer。它是一个 Visual Studio 插件,允许您以图形方式设计 .NET 配置部分并自动为它们生成所有必需的代码和架构定义 (XSD)。

    【讨论】:

      猜你喜欢
      • 2016-12-07
      • 1970-01-01
      • 2012-03-27
      • 1970-01-01
      • 2011-02-09
      • 2017-07-25
      • 2011-02-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多