So I'm coding a quick Windows Forms app in Visual Studio 2005 and noticed that the following line resulted in a compiler error:
SqlConnectionmyConnection = new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]);
The trick is that this is not a compiler error, but a warning. The warning text is:
Warning 1 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings
So I spent some time trying to figure out where the configuraiton manager class was. You have to manually add the System.configuraton (Read Small Letter "c") to access this class and use it. Then the line becomes:
SqlConnectionmyConnection = new SqlConnection(config.Sections["ConnectionString"].ToString());
Never mind that I'm not using Enterprise Library. I'm using CodeSmith to generate Data Access Layer code (which I hate to write) and plan to change this template later to be Enterprise Library November 2005 CTP .NET 2.0 Compliant.