【发布时间】:2010-09-27 13:05:43
【问题描述】:
我的 app.config 文件中有一个与我们的 IoC 容器类相关的自定义部分。在编辑本节的配置文件时如何获得智能感知,以及摆脱通知我缺少架构的编译器消息。
我在这里找到了这个问题:app.config configSections custom settings can not find schema information,但我不明白它是否适用于我的问题,以及如果适用的话如何使用那里的答案。
我还找到了这个页面How to get Intellisense for Web.config and App.config in Visual Studio .NET,但它说在运行应用程序之前要删除 xmlns 属性。这真的是唯一/最好的方法吗?
这是一个简单文件的示例:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="ServiceContainers"
type="LVK.IoC.RegistrationsSectionHandler, LVK"/>
</configSections>
<ServiceContainers>
<Registration type="DatabaseConnection" class="DatabaseConnection">
<Parameter name="connectionString" type="System.String"
value="TYPE=MSSQL2000;SERVER=localhost;DATABASE=db"/>
</Registration>
</ServiceContainers>
</configuration>
基本上,我希望能够在<ServiceContainers> 节点内输入<R,并在智能感知下拉列表中获得向我建议的注册,以及它的适当属性。
【问题讨论】:
标签: c# .net configuration app-config custom-sections