CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ConfigurationManager.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ConfigurationManager.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>ConfigurationManager that abstracts underlying configuration</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Collections.Specialized;
10
11namespace Csla.Configuration
12{
17 public static class ConfigurationManager
18 {
19 private static NameValueCollection _settings = new NameValueCollection();
20
21 static ConfigurationManager()
22 {
23#if !NETSTANDARD2_0 && !NET5_0
24 try
25 {
26 _settings = System.Configuration.ConfigurationManager.AppSettings;
27 foreach (System.Configuration.ConnectionStringSettings item in System.Configuration.ConfigurationManager.ConnectionStrings)
28 ConnectionStrings.Add(item.Name, new ConnectionStringSettings(item));
29 }
30 catch (Exception ex)
31 {
32 throw new ConfigurationErrorsException(ex.Message, ex);
33 }
34#endif
35 }
36
40 public static NameValueCollection AppSettings
41 {
42 get
43 {
44 return _settings;
45 }
46 set
47 {
48 _settings = value;
49 ApplicationContext.SettingsChanged();
50 }
51 }
52
57 public static ConnectionStringSettingsCollection ConnectionStrings { get; set; }
58 = new ConnectionStringSettingsCollection();
59 }
60}