PageRenderTime 21ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Source/Bifrost/Execution/ITypeDiscoverer.cs

#
C# | 84 lines | 15 code | 5 blank | 64 comment | 0 complexity | e17fad0aa6a8e3656c3efeeb703d3282 MD5 | raw file
 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
22using System;
23using System.Collections.Generic;
24
25namespace Bifrost.Execution
26{
27	/// <summary>
28	/// Discovers types based upon basetypes
29	/// </summary>
30	public interface ITypeDiscoverer
31	{
32        /// <summary>
33        /// Returns all discovered types
34        /// </summary>
35        /// <returns><see cref="IEnumerable{Type}"/> with all the types discovered</returns>
36	    IEnumerable<Type> GetAll();
37
38		/// <summary>
39		/// Find a single implementation of a basetype
40		/// </summary>
41		/// <typeparam name="T">Basetype to find for</typeparam>
42		/// <returns>Type found</returns>
43		/// <remarks>
44		/// If the base type is an interface, it will look for any types implementing the interface.
45		/// If it is a class, it will find anyone inheriting from that class
46		/// </remarks>
47		/// <exception cref="ArgumentException">If there is more than one instance found</exception>
48		Type FindSingle<T>();
49
50		/// <summary>
51		/// Find multiple implementations of a basetype
52		/// </summary>
53		/// <typeparam name="T">Basetype to find for</typeparam>
54		/// <returns>All types implementing or inheriting from the given basetype</returns>
55		/// <remarks>
56		/// If the base type is an interface, it will look for any types implementing the interface.
57		/// If it is a class, it will find anyone inheriting from that class
58		/// </remarks>
59		Type[] FindMultiple<T>();
60
61		/// <summary>
62		/// Find a single implementation of a basetype
63		/// </summary>
64		/// <param name="type">Basetype to find for</param>
65		/// <returns>Type found</returns>
66		/// <remarks>
67		/// If the base type is an interface, it will look for any types implementing the interface.
68		/// If it is a class, it will find anyone inheriting from that class
69		/// </remarks>
70		/// <exception cref="ArgumentException">If there is more than one instance found</exception>
71		Type FindSingle(Type type);
72
73		/// <summary>
74		/// Find multiple implementations of a basetype
75		/// </summary>
76		/// <param name="type">Basetype to find for</param>
77		/// <returns>All types implementing or inheriting from the given basetype</returns>
78		/// <remarks>
79		/// If the base type is an interface, it will look for any types implementing the interface.
80		/// If it is a class, it will find anyone inheriting from that class
81		/// </remarks>
82		Type[] FindMultiple(Type type);
83	}
84}