问题描述
在一个小C#项目,我试图创建一个简单的自定义configsection。
我跟着和一切工作的奥秘很好......除了事实,我没有得到的配置XSD验证和智能。
in a small c# project, I'm trying to create a simple custom configsection.I followed the instructions in CodeProject: Unraveling the Mysteries of .NET 2.0 Configuration and everything work nicely... apart from the fact that I don't get xsd validation and intellisense on the config.
我的配置如下图所示。
<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>
在这篇文章中(的)我发现会为configsection XSD文件的工具。它工作正常,即它提供了智能感知和验证,主属性(例如价格)和单一的元素(煮)。但我不能使它的藏品(以下简称浇头)工作。
On this article (XSDExtractor) I found a tool that creates an xsd file for the configsection. It works fine, i.e. it provides intellisense and validation, for the main attributes (e.g. "price") and the single elements ("cook"). However I could not make it work for the collections (the "toppings").
我的问题:
- 是否有任何其他工具,它提供的ConfigurationSection类的XSD一代?
- 有一个人与一个集合属性? $ b A的ConfigurationSection运行XSDExtractor成功$ b
- Is there any other tool that provides xsd generation of ConfigurationSection classes?
- Has someone run XSDExtractor successfully on a ConfigurationSection with a collection property?
非常感谢,
尼古拉
Thanks a lot,Nicola
推荐答案
我没有用XSDExtractor只有一个工具,我强烈建议是。它是一个Visual Studio插件,它允许您以图形设计.NET配置部分,并自动生成所有必需的代码,并为他们的架构定义(XSD)。
I haven't used XSDExtractor but one tool which I strongly recommend is Configuration Section Designer. It's a Visual Studio add-in that allows you to graphically design .NET Configuration Sections and automatically generates all the required code and a schema definition (XSD) for them.
这篇关于提供了智能感知/ XSD验证,以configsections的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!