views:

92

answers:

1

I just wrote some .NET code to get connection string from the config file. The config file is as below:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <appSettings>
    <add key="key1" value="hello,world!"/>
  </appSettings>

  <connectionStrings>
    <add name="conn1" connectionString="abcd"/>
  </connectionStrings>

</configuration>

.NET Framework provide the following types to get the connection string:

1- ConnectionStringsSection : stands for the config section containing several connection strings

2- ConnectionStringSettingsCollection : stands for the connection string collection

3- ConnectionStringSettings : stands for a certain connection string.

.NET Framework also provide the following types to get the App Settings:

4- AppSettingsSection

5- KeyValueConfigurationCollection

6- KeyValueConfigurationElement

Compare 2 to 5, 3 to 6, why are there extra "s" in ConnectionStringSetting[s]Collection and ConnectionStringSetting[s]?

This mis-spelling is really mis-leading. I think it's a design flaw.

Has anyone noticed that?

+9  A: 

Because its in English. Settings implies multiple as does Configuration. A configuration can have multiple properties but a setting is one 'thing'. Configurations would imply a collection of multiple properties. Not a typo just an English language quirk

Leom Burke
Thanks for your answer. As you said, "settings" implies plural. But one more thing, the ConnectionStringSettings type only stands for a single connection string, it doesn't make sense to use a plural word here, I think ConnectionString is good enough.
smwikipedia
+1 "Because its in English" we really need some form of syntax highlighting or error checking for that language
PostMan
@smwikipedia - its because when you access ConnectionStringSettings in code you are getting all of the settings for a single ConnectionString - ConnectionString, ProviderName...etc.
Leom Burke
@Leom, thanks very much~ that makes sense now. Grammar seems to be playing a non-trivial part in programming. :)
smwikipedia