Class XmlConfigurationProvider
- Namespace
- Dynamicweb.Configuration.Xml
- Assembly
- Dynamicweb.Core.dll
Reads and writes xml configuration files.
public class XmlConfigurationProvider : IConfigurationProvider
- Inheritance
-
XmlConfigurationProvider
- Implements
- Inherited Members
Constructors
XmlConfigurationProvider(string)
Creates a new instance of the xml configuration provider.
public XmlConfigurationProvider(string fullPath)
Parameters
fullPath
stringAbsolute path to an xml configuration file.
XmlConfigurationProvider(XmlDocument)
Loads the data from the provided xml document
public XmlConfigurationProvider(XmlDocument document)
Parameters
document
XmlDocument
Properties
Path
Gets the path to the configuration file.
public string? Path { get; }
Property Value
Methods
Contains(string)
Determines whether the configuration contains an entry with the specified key.
public bool Contains(string key)
Parameters
key
stringThe key to locate in the configuration.
Returns
- bool
true
if the configuration contains the specified configuration key; otherwise,false
.
GetKeys()
Gets all keys that can be used to get or set data.
public ICollection<string> GetKeys()
Returns
- ICollection<string>
keys
Persist()
Saves the configuration data to an xml file.
public void Persist()
Reload()
Reloads the configuration data from file.
public void Reload()
SetValue(string, string)
Sets the value of an entry with the specified key.
public void SetValue(string key, string value)
Parameters
key
stringThe key of the entry to set a value for.
value
stringA string that represents the value of an entry.
TryGet(string, out string?)
Attempts to get the value associated with the specified key.
public bool TryGet(string key, out string? value)
Parameters
key
stringKey of the value to get.
value
stringWhen this method returns, contains the value associated with the specified key, or null if the operation failed.
Returns
- bool
true
if the specified key was found; otherwise,false
.