Silverlight Configuration Sections

I am working with a silverlight application that has a rather large appsettings section in web.config. During the search, I cannot find examples of using custom configuration sections using silverlight. I cannot get this problem first in Silverlight.

What is the best practice of stopping entering configuration values ​​in appconfig and using an approach closer to custom configuration sections. Thanks you

+3
source share
1 answer

Web.ConfigIt is intended solely for use by a website that serves, among other things, as silverlight application files. The Silverlight applications on the website do not have any concept of "App.config".

- NameValueSectionHandler: -

<configuration>
  <configSections>
    <section name="myCustom" type="System.Configuration.NameValueSectionHandler" />
  </configSections>
  <myCustom>
    <add key="someItem" value="someValue" />
  </myCustom>
  <!-- other sections here -->
</configuration>

HttpContext.

string someValue = ((NameValueCollection)context.GetSection("myCustom"))["someItem"];

, IConfigurationSectionHandler, Create, XmlNode, "myCustom" node.

. .

initParams . , xml xml .

+1

Source: https://habr.com/ru/post/1745460/


All Articles