PageRenderTime 44ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/Bifrost/Execution/ITypeDiscoverer.cs

#
C# | 84 lines | 15 code | 5 blank | 64 comment | 0 complexity | e17fad0aa6a8e3656c3efeeb703d3282 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. #region License
  2. //
  3. // Copyright (c) 2008-2012, DoLittle Studios and Komplett ASA
  4. //
  5. // Licensed under the Microsoft Permissive License (Ms-PL), Version 1.1 (the "License")
  6. // With one exception :
  7. // Commercial libraries that is based partly or fully on Bifrost and is sold commercially,
  8. // must obtain a commercial license.
  9. //
  10. // You may not use this file except in compliance with the License.
  11. // You may obtain a copy of the license at
  12. //
  13. // http://bifrost.codeplex.com/license
  14. //
  15. // Unless required by applicable law or agreed to in writing, software
  16. // distributed under the License is distributed on an "AS IS" BASIS,
  17. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. // See the License for the specific language governing permissions and
  19. // limitations under the License.
  20. //
  21. #endregion
  22. using System;
  23. using System.Collections.Generic;
  24. namespace Bifrost.Execution
  25. {
  26. /// <summary>
  27. /// Discovers types based upon basetypes
  28. /// </summary>
  29. public interface ITypeDiscoverer
  30. {
  31. /// <summary>
  32. /// Returns all discovered types
  33. /// </summary>
  34. /// <returns><see cref="IEnumerable{Type}"/> with all the types discovered</returns>
  35. IEnumerable<Type> GetAll();
  36. /// <summary>
  37. /// Find a single implementation of a basetype
  38. /// </summary>
  39. /// <typeparam name="T">Basetype to find for</typeparam>
  40. /// <returns>Type found</returns>
  41. /// <remarks>
  42. /// If the base type is an interface, it will look for any types implementing the interface.
  43. /// If it is a class, it will find anyone inheriting from that class
  44. /// </remarks>
  45. /// <exception cref="ArgumentException">If there is more than one instance found</exception>
  46. Type FindSingle<T>();
  47. /// <summary>
  48. /// Find multiple implementations of a basetype
  49. /// </summary>
  50. /// <typeparam name="T">Basetype to find for</typeparam>
  51. /// <returns>All types implementing or inheriting from the given basetype</returns>
  52. /// <remarks>
  53. /// If the base type is an interface, it will look for any types implementing the interface.
  54. /// If it is a class, it will find anyone inheriting from that class
  55. /// </remarks>
  56. Type[] FindMultiple<T>();
  57. /// <summary>
  58. /// Find a single implementation of a basetype
  59. /// </summary>
  60. /// <param name="type">Basetype to find for</param>
  61. /// <returns>Type found</returns>
  62. /// <remarks>
  63. /// If the base type is an interface, it will look for any types implementing the interface.
  64. /// If it is a class, it will find anyone inheriting from that class
  65. /// </remarks>
  66. /// <exception cref="ArgumentException">If there is more than one instance found</exception>
  67. Type FindSingle(Type type);
  68. /// <summary>
  69. /// Find multiple implementations of a basetype
  70. /// </summary>
  71. /// <param name="type">Basetype to find for</param>
  72. /// <returns>All types implementing or inheriting from the given basetype</returns>
  73. /// <remarks>
  74. /// If the base type is an interface, it will look for any types implementing the interface.
  75. /// If it is a class, it will find anyone inheriting from that class
  76. /// </remarks>
  77. Type[] FindMultiple(Type type);
  78. }
  79. }