jellyfin-server/MediaBrowser.Common/Configuration/IConfigurationFactory.cs

48 lines
1.5 KiB
C#
Raw Normal View History

using System;
2018-12-27 23:27:57 +00:00
using System.Collections.Generic;
namespace MediaBrowser.Common.Configuration
{
2020-02-10 09:26:28 +00:00
/// <summary>
/// Provides an interface to retrieve a configuration store. Classes with this interface are scanned for at
/// application start to dynamically register configuration for various modules/plugins.
/// </summary>
2018-12-27 23:27:57 +00:00
public interface IConfigurationFactory
{
2020-02-10 09:26:28 +00:00
/// <summary>
/// Get the configuration store for this module.
/// </summary>
/// <returns>The configuration store.</returns>
2018-12-27 23:27:57 +00:00
IEnumerable<ConfigurationStore> GetConfigurations();
}
2020-02-10 09:26:28 +00:00
/// <summary>
/// Describes a single entry in the application configuration.
/// </summary>
2018-12-27 23:27:57 +00:00
public class ConfigurationStore
{
2020-02-10 09:26:28 +00:00
/// <summary>
/// Gets or sets the unique identifier for the configuration.
/// </summary>
2018-12-27 23:27:57 +00:00
public string Key { get; set; }
2020-02-10 09:26:28 +00:00
/// <summary>
/// Gets or sets the type used to store the data for this configuration entry.
/// </summary>
2018-12-27 23:27:57 +00:00
public Type ConfigurationType { get; set; }
}
2020-02-10 09:26:28 +00:00
/// <summary>
/// A configuration store that can be validated.
/// </summary>
2018-12-27 23:27:57 +00:00
public interface IValidatingConfiguration
{
2020-02-10 09:26:28 +00:00
/// <summary>
/// Validation method to be invoked before saving the configuration.
/// </summary>
/// <param name="oldConfig">The old configuration.</param>
/// <param name="newConfig">The new configuration.</param>
2018-12-27 23:27:57 +00:00
void Validate(object oldConfig, object newConfig);
}
}