Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Кто работал с app.config? / 3 сообщений из 3, страница 1 из 1
10.02.2005, 11:19
    #32909698
MEGA_LexX
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Кто работал с app.config?
мне нужно в этом файле создать пользовательскую секцию и прописать там следующие вещи
Код: plaintext
1.
2.
3.
4.
5.
6.
<mySection>
   <procedureName>Имя_процедуры</procedureName>
   <procedureName>Имя_процедуры</procedureName>

..........
   <procedureName>Имя_процедуры</procedureName>
</mySection>
как это сделать в самом конфиге а главное как это програмно считать?
...
Рейтинг: 0 / 0
10.02.2005, 12:58
    #32910011
Mr. GES
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Кто работал с app.config?
А вы попробуйте, например, добавить в дизайнере какой нибудь объект на свою форму и с разделе properties - dinamiс propeties прописать какое нибудь из свойств, у вас автоматически изменится файл app.config и добавится код.
Он прост.
...
Рейтинг: 0 / 0
10.02.2005, 13:41
    #32910129
MEGA_LexX
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Кто работал с app.config?
Ладно я сам нарыл
не помню откуда но на сайте мсдн вот
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
System.Configuration.ConfigXmlWhitespace Nodes Are Added in the Custom Sections of the App.config File
Article ID : 823054 
Last Review : October 24, 2003 
Revision : 1.0 

SYMPTOMS
If you define a custom configuration handler, and then you use the ConfigurationSettings.GetConfig method to load a custom section from the configuration file of a Microsoft .NET Framework-based application, the resulting XmlNode may contain child nodes of type System.Configuration.ConfigXmlWhitespace for each white space that occurs in the custom section.
RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next .NET Framework 1.1 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site: 
http://support.microsoft.com/default.aspx?scid=fh;[LN];CNTACTMS 
Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel. 
   Date         Time   Version       Size       File name
   --------------------------------------------------------------
   17-Sep-2003  22:18  1.1.4322.947    258,048  Aspnet_isapi.dll
   17-Sep-2003  22:18  1.1.4322.947     20,480  Aspnet_regiis.exe
   17-Sep-2003  22:18  1.1.4322.947     32,768  Aspnet_state.exe
   17-Sep-2003  22:18  1.1.4322.947     32,768  Aspnet_wp.exe
   15-May-2003  18:49                   33,522  InstallPersistSqlState.sql
   15-May-2003  18:49                   34,150  InstallSqlState.sql
   17-Sep-2003  22:09  1.1.4322.947     94,208  PerfCounter.dll
   18-Sep-2003  19:43  1.1.4322.947  1,216,512  System.dll
   18-Sep-2003  19:40  1.1.4322.947    323,584  System.Runtime.Remoting.dll
   18-Sep-2003  19:43  1.1.4322.947  1,253,376  System.Web.dll
   18-Sep-2003  19:42  1.1.4322.947    819,200  System.Web.Mobile.dll
   18-Sep-2003  19:41  1.1.4322.947    569,344  System.Web.Services.dll
   18-Sep-2003  19:44  1.1.4322.947  1,335,296  System.XML.dll
   17-Sep-2003  22:13                   14,472  WebUIValidation.jsSTATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article.
MORE INFORMATION
Steps to Reproduce the Behavior
1. Start Microsoft Visual Studio .NET 2003. 
2. On the File menu, point to New, and then click Project. 
3. In the New Project dialog box, click Visual C# Projects under Project Types, and then click Console Application under Templates. 
4. In the Name text box, replace the default text with MyApplication, and then click OK. By default, Class1.cs is created. 
5. Replace the code in Class1.cs with the following code: 
using System;
using System.Xml;
using System.Configuration;

namespace MyApplication
{
	public class MyConfigHandler : IConfigurationSectionHandler
	{
		public MyConfigHandler()
		{

		}
		public object Create(object parent, object configContext, XmlNode section)
		{
			return section;
		}
	}

	class MyClass
	{
		[STAThread]
		static void Main(string[] args)
		{
			// Get an XmlNode that refers to the custom configuration section.
			XmlNode node = (XmlNode) ConfigurationSettings.GetConfig("mySection");

			// Process all child nodes.
			// Print the "id" attribute, followed by the node type.
			foreach (XmlNode child in node.ChildNodes)
			{
				try
				{
					Console.Write(child.Attributes["id"].Value);
				}
				catch
				{
					Console.Write("?");
				}

				Console.Write(" ");
				Console.WriteLine(child.ToString());
			}
		}
	}
}
     
6. On the Project menu, click Add New Item. 
7. In the Add New Item - MyApplication dialog box, click XML File under Templates. 
8. In the Name text box, replace the default text with App.config, and then click Open. 
9. Replace the code in App.config with the following code: 
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<configSections>
		<section name="mySection" type="MyApplication.MyConfigHandler, MyApplication" />
	</configSections>
	<mySection>
		<tag id="0" />
	</mySection>
</configuration> 
10. Build the project, and then run the application. 
--------------------------------------------------------------------------------
APPLIES TO
• Microsoft .NET Framework 1.1 
...
Рейтинг: 0 / 0
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Кто работал с app.config? / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]