diff options
Diffstat (limited to 'MediaBrowser.Common/IApplicationHost.cs')
| -rw-r--r-- | MediaBrowser.Common/IApplicationHost.cs | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index 849037ac4..ddcf2ac17 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -2,12 +2,17 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Threading.Tasks; -using MediaBrowser.Common.Plugins; -using Microsoft.Extensions.DependencyInjection; namespace MediaBrowser.Common { /// <summary> + /// Delegate used with GetExports{T}. + /// </summary> + /// <param name="type">Type to create.</param> + /// <returns>New instance of type <param>type</param>.</returns> + public delegate object CreationDelegate(Type type); + + /// <summary> /// An interface to be implemented by the applications hosting a kernel. /// </summary> public interface IApplicationHost @@ -54,6 +59,11 @@ namespace MediaBrowser.Common Version ApplicationVersion { get; } /// <summary> + /// Gets or sets the service provider. + /// </summary> + IServiceProvider ServiceProvider { get; set; } + + /// <summary> /// Gets the application version. /// </summary> /// <value>The application version.</value> @@ -72,12 +82,6 @@ namespace MediaBrowser.Common string ApplicationUserAgentAddress { get; } /// <summary> - /// Gets the plugins. - /// </summary> - /// <value>The plugins.</value> - IReadOnlyList<IPlugin> Plugins { get; } - - /// <summary> /// Gets all plugin assemblies which implement a custom rest api. /// </summary> /// <returns>An <see cref="IEnumerable{Assembly}"/> containing the plugin assemblies.</returns> @@ -102,6 +106,22 @@ namespace MediaBrowser.Common IReadOnlyCollection<T> GetExports<T>(bool manageLifetime = true); /// <summary> + /// Gets the exports. + /// </summary> + /// <typeparam name="T">The type.</typeparam> + /// <param name="defaultFunc">Delegate function that gets called to create the object.</param> + /// <param name="manageLifetime">If set to <c>true</c> [manage lifetime].</param> + /// <returns><see cref="IReadOnlyCollection{T}" />.</returns> + IReadOnlyCollection<T> GetExports<T>(CreationDelegate defaultFunc, bool manageLifetime = true); + + /// <summary> + /// Gets the export types. + /// </summary> + /// <typeparam name="T">The type.</typeparam> + /// <returns>IEnumerable{Type}.</returns> + IEnumerable<Type> GetExportTypes<T>(); + + /// <summary> /// Resolves this instance. /// </summary> /// <typeparam name="T">The <c>Type</c>.</typeparam> @@ -115,12 +135,6 @@ namespace MediaBrowser.Common Task Shutdown(); /// <summary> - /// Removes the plugin. - /// </summary> - /// <param name="plugin">The plugin.</param> - void RemovePlugin(IPlugin plugin); - - /// <summary> /// Initializes this instance. /// </summary> void Init(); |
