IConfigurationFactory.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. namespace MediaBrowser.Common.Configuration
  4. {
  5. /// <summary>
  6. /// Provides an interface to retrieve a configuration store. Classes with this interface are scanned for at
  7. /// application start to dynamically register configuration for various modules/plugins.
  8. /// </summary>
  9. public interface IConfigurationFactory
  10. {
  11. /// <summary>
  12. /// Get the configuration store for this module.
  13. /// </summary>
  14. /// <returns>The configuration store.</returns>
  15. IEnumerable<ConfigurationStore> GetConfigurations();
  16. }
  17. /// <summary>
  18. /// Describes a single entry in the application configuration.
  19. /// </summary>
  20. public class ConfigurationStore
  21. {
  22. /// <summary>
  23. /// Gets or sets the unique identifier for the configuration.
  24. /// </summary>
  25. public string Key { get; set; }
  26. /// <summary>
  27. /// Gets or sets the type used to store the data for this configuration entry.
  28. /// </summary>
  29. public Type ConfigurationType { get; set; }
  30. }
  31. /// <summary>
  32. /// A configuration store that can be validated.
  33. /// </summary>
  34. public interface IValidatingConfiguration
  35. {
  36. /// <summary>
  37. /// Validation method to be invoked before saving the configuration.
  38. /// </summary>
  39. /// <param name="oldConfig">The old configuration.</param>
  40. /// <param name="newConfig">The new configuration.</param>
  41. void Validate(object oldConfig, object newConfig);
  42. }
  43. }