.net配置文件的基础

Basics of .net config files [closed]
2021-02-23
  •  译文(汉语)
  •  原文(英语)

我正在寻找有关创建C#.Net配置文件的解释和介绍.Ive查看了MSDN并进行了一些搜索,但找不到可以对创建配置文件进行某种形式介绍的文档或网页.结构,语法等

一个通用的示例是RegisterWellKnownServiceType()创建.在类结构中,您以其全名RegisterWellKnownServiceType(...)进行调用,但在配置文件中,您仅将其称为

<service>
    <wellknown ..(Insert variables).. />
</service>

您为什么将RegisterWellKnownServiceType缩写为仅知名?我希望您使用完整的RegisterWellKnownServiceType来使用它?我敢肯定还有更多这样的例子,所以将对两个链接或对配置文件的一般性解释表示赞赏.谢谢

速聊1:
那对我没有帮助.因此,为什么不只使用servicetype或任何其他任意词集来缩短它.
解决过程1

.NET配置文件是XML文件.

在这里阅读可用的配置部分/设置,但是我不会花太多精力,因为这些可能不是一成不变的.有关ASP.NET配置文档,请参见此处.这些配置设置用于配置应用程序中使用的.NET Framework组件.似乎.NET组件的架构师使用了他们直观地认为适合该元素或其他元素的任何命名约定,并且我看不到类名和配置元素之间的任何特定规则.

众所周知的元素是在"远程设置架构"下定义的.

请注意,在应用程序的代码中,您可以读取/写入.config文件,因此您可以为应用程序提供自己的配置部分,并使用所需的任何命名约定.

速聊1:
谢谢m0s.我看了看那些链接,但是还不清楚.以后我会以清晰的头脑重新审视它.关于选择自己的名称,它在命名各种配置调用的问题上更加清晰.谢谢

I am looking for an explanation and introduction to creating C#.Net configuration files. Ive looked on MSDN and did some searches, but cant find a document or web page that can give some sort of introduction to creating config files. Structure, syntax etc.

A generic example is the RegisterWellKnownServiceType() creation. In the a class structure you call it by its full name, RegisterWellKnownServiceType(...), but in the config file you only refer to it as

<service>
    <wellknown ..(Insert variables).. />
</service>

Why would you abbreviate RegisterWellKnownServiceType to wellknown only ? I would have expected you to use the full RegisterWellKnownServiceType to use it? Im am sure there are more examples like this, so a couple of links or a generic explanation on config files will be appreciated. Thanks

Talk1:
That doesn't help me. So why not just use servicetype or any other set of arbitrary words to shorten it.
Solutions1

.NET configuration files are XML files.

Read here what configuration sections/settings are available, but I wouldn't put too much effort into it as these probably aren't written in stone. For ASP.NET configuration documentation look here. These configuration settings are for configuring components of .NET framework that are used in your application. It seems architects of .NET components used whatever naming conventions they intuitively felt right for this or other element, and I don't see any specific rule between class names and config elements.

The wellknown element is defined under Remoting Settings Schema.

Note that in the code of your application you can read/write the .config files, so you can come up with your own configuration sections for your app, and use whatever naming conventions you like.

Talk1:
Thanks m0s. I had a look at those links but its still a bit unclear. Ill revisit it later with a clear mind. With respect to the choosing your own names, it set a bit more clarity on the issue of naming the various config calls. Thanks
转载于:https://stackoverflow.com/questions/23692539/basics-of-net-config-files

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入