PageRenderTime 49ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/BlogEngine/DotNetSlave.BusinessLogic/Providers/BlogProviderCollection.cs

#
C# | 52 lines | 31 code | 8 blank | 13 comment | 3 complexity | 7b0de53d9ee6e0346dc17c19efb7109c MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. namespace BlogEngine.Core.Providers
  2. {
  3. using System;
  4. using System.Configuration.Provider;
  5. /// <summary>
  6. /// A collection of all registered providers.
  7. /// </summary>
  8. public class BlogProviderCollection : ProviderCollection
  9. {
  10. #region Indexers
  11. /// <summary>
  12. /// Gets a provider by its name.
  13. /// </summary>
  14. /// <param name="name">The name of the provider.</param>
  15. public new BlogProvider this[string name]
  16. {
  17. get
  18. {
  19. return (BlogProvider)base[name];
  20. }
  21. }
  22. #endregion
  23. #region Public Methods
  24. /// <summary>
  25. /// Add a provider to the collection.
  26. /// </summary>
  27. /// <param name="provider">
  28. /// The provider.
  29. /// </param>
  30. public override void Add(ProviderBase provider)
  31. {
  32. if (provider == null)
  33. {
  34. throw new ArgumentNullException("provider");
  35. }
  36. if (!(provider is BlogProvider))
  37. {
  38. throw new ArgumentException("Invalid provider type", "provider");
  39. }
  40. base.Add(provider);
  41. }
  42. #endregion
  43. }
  44. }