Example #1
0
 /// <summary>
 /// Gets the new instances of the implementations of the type specified by the type parameter
 /// or empty enumeration if no implementations found.
 /// </summary>
 /// <typeparam name="T">The type parameter to find implementations of.</typeparam>
 /// <param name="useCaching">
 /// Determines whether the type cache should be used to avoid assemblies scanning next time,
 /// when the instance(s) of the same type(s) is requested.
 /// </param>
 /// <returns>The instances of the found implementations of the given type.</returns>
 public static IEnumerable <T> GetInstances <T>(bool useCaching = false)
 {
     return(ExtensionManager.GetInstances <T>(null, useCaching, new object[] { }));
 }
Example #2
0
 /// <summary>
 /// Gets the new instances (using constructor that matches the arguments) of the implementations
 /// of the type specified by the type parameter or empty enumeration if no implementations found.
 /// </summary>
 /// <typeparam name="T">The type parameter to find implementations of.</typeparam>
 /// <param name="useCaching">
 /// Determines whether the type cache should be used to avoid assemblies scanning next time,
 /// when the instance(s) of the same type(s) is requested.
 /// </param>
 /// <param name="args">The arguments to be passed to the constructors.</param>
 /// <returns>The instances of the found implementations of the given type.</returns>
 public static IEnumerable <T> GetInstances <T>(bool useCaching = false, params object[] args)
 {
     return(ExtensionManager.GetInstances <T>(null, useCaching, args));
 }
Example #3
0
 public static T GetInstance <T>()
 {
     return(ExtensionManager.GetInstance <T>(null));
 }
Example #4
0
 /// <summary>
 /// Gets the new instance (using constructor that matches the arguments) of the first implementation
 /// of the type specified by the type parameter and located in the assemblies filtered by the predicate
 /// or null if no implementations found.
 /// </summary>
 /// <typeparam name="T">The type parameter to find implementation of.</typeparam>
 /// <param name="predicate">The predicate to filter the assemblies.</param>
 /// <param name="useCaching">
 /// Determines whether the type cache should be used to avoid assemblies scanning next time,
 /// when the instance(s) of the same type(s) is requested.
 /// </param>
 /// <param name="args">The arguments to be passed to the constructor.</param>
 /// <returns>The instance of the first found implementation of the given type.</returns>
 public static T GetInstance <T>(Func <Assembly, bool> predicate, bool useCaching = false, params object[] args)
 {
     return(ExtensionManager.GetInstances <T>(predicate, useCaching, args).FirstOrDefault());
 }
Example #5
0
 public static Type GetImplementation <T>()
 {
     return(ExtensionManager.GetImplementation <T>(null));
 }
Example #6
0
 public static IEnumerable <Type> GetImplementations <T>()
 {
     return(ExtensionManager.GetImplementations <T>(null));
 }
Example #7
0
 /// <summary>
 /// Gets the first implementation of the type specified by the type parameter and located in the assemblies
 /// filtered by the predicate or null if no implementations found.
 /// </summary>
 /// <typeparam name="T">The type parameter to find implementation of.</typeparam>
 /// <param name="predicate">The predicate to filter the assemblies.</param>
 /// <returns></returns>
 public static Type GetImplementation <T>(Func <Assembly, bool> predicate)
 {
     return(ExtensionManager.GetImplementations <T>(predicate).FirstOrDefault());
 }
Example #8
0
 public static IEnumerable <T> GetInstances <T>()
 {
     return(ExtensionManager.GetInstances <T>(null));
 }
Example #9
0
 /// <summary>
 /// Gets the new instances of the implementations of the type specified by the type parameter
 /// and located in the assemblies filtered by the predicate or empty enumeration
 /// if no implementations found.
 /// </summary>
 /// <typeparam name="T">The type parameter to find implementations of.</typeparam>
 /// <param name="predicate">The predicate to filter the assemblies.</param>
 /// <returns></returns>
 public static IEnumerable <T> GetInstances <T>(Func <Assembly, bool> predicate)
 {
     return(ExtensionManager.GetInstances <T>(predicate, new object[] { }));
 }
Example #10
0
 /// <summary>
 /// Gets the new instances (using constructor that matches the arguments) of the implementations
 /// of the type specified by the type parameter or empty enumeration if no implementations found.
 /// </summary>
 /// <typeparam name="T">The type parameter to find implementations of.</typeparam>
 /// <param name="args">The arguments to be passed to the constructors.</param>
 /// <returns></returns>
 public static IEnumerable <T> GetInstances <T>(params object[] args)
 {
     return(ExtensionManager.GetInstances <T>(null, args));
 }
Example #11
0
 /// <summary>
 /// Gets the new instance of the first implementation of the type specified by the type parameter
 /// and located in the assemblies filtered by the predicate or null if no implementations found.
 /// </summary>
 /// <typeparam name="T">The type parameter to find implementation of.</typeparam>
 /// <param name="predicate">The predicate to filter the assemblies.</param>
 /// <returns></returns>
 public static T GetInstance <T>(Func <Assembly, bool> predicate)
 {
     return(ExtensionManager.GetInstances <T>(predicate).FirstOrDefault());
 }
Example #12
0
 /// <summary>
 /// Gets the new instance (using constructor that matches the arguments) of the first implementation
 /// of the type specified by the type parameter or null if no implementations found.
 /// </summary>
 /// <typeparam name="T">The type parameter to find implementation of.</typeparam>
 /// <param name="args">The arguments to be passed to the constructor.</param>
 /// <returns></returns>
 public static T GetInstance <T>(params object[] args)
 {
     return(ExtensionManager.GetInstance <T>(null, args));
 }
Example #13
0
 /// <summary>
 /// Gets the new instance of the first implementation of the type specified by the type parameter
 /// or null if no implementations found.
 /// </summary>
 /// <typeparam name="T">The type parameter to find implementation of.</typeparam>
 /// <returns></returns>
 public static T GetInstance <T>()
 {
     return(ExtensionManager.GetInstance <T>(null, new object[] { }));
 }