main
cs 55 lines 2.61 KB
Raw
1 // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3 namespace WixToolset.Extensibility.Services
4 {
5 using System.Collections.Generic;
6 using System.Reflection;
7 using WixToolset.Extensibility.Data;
8
9 /// <summary>
10 /// Loads extensions and uses the extensions' factories to provide services.
11 /// </summary>
12 public interface IExtensionManager
13 {
14 /// <summary>
15 /// Adds an extension assembly directly to the manager.
16 /// </summary>
17 /// <param name="extensionAssembly">Extension assembly.</param>
18 void Add(Assembly extensionAssembly);
19
20 /// <summary>
21 /// Loads an extension assembly from an extension reference string.
22 /// </summary>
23 /// <param name="extensionReference">Reference to the extension.</param>
24 /// <returns>The loaded assembly. This assembly can be ignored since the extension manager maintains the list of loaded assemblies internally.</returns>
25 /// <remarks>
26 /// <paramref name="extensionReference"/> can be in several different forms:
27 /// <list type="number">
28 /// <item><term>Full path to an extension file (C:\MyExtensions\MyExtension.Example.wixext.dll)</term></item>
29 /// <item><term>Reference to latest version of an extension in the cache (MyExtension.Example.wixext)</term></item>
30 /// <item><term>Versioned reference to specific extension in the cache (MyExtension.Example.wixext/1.0.2)</term></item>
31 /// <item><term>Relative path to an extension file (..\..\MyExtensions\MyExtension.Example.wixext.dll)</term></item>
32 /// </list>
33 /// </remarks>
34 void Load(string extensionReference);
35
36 /// <summary>
37 /// Gets extensions cache locations.
38 /// </summary>
39 /// <returns>List of cache locations where extensions may be found.</returns>
40 IReadOnlyCollection<IExtensionCacheLocation> GetCacheLocations();
41
42 /// <summary>
43 /// Gets the root folder name used in extension's package.
44 /// </summary>
45 /// <returns>Root folder name to find extension in a package.</returns>
46 string GetExtensionPackageRootFolderName();
47
48 /// <summary>
49 /// Gets extensions of specified type from factories loaded into the extension manager.
50 /// </summary>
51 /// <typeparam name="T">Type of extension to get.</typeparam>
52 /// <returns>Extensions of the specified type.</returns>
53 IReadOnlyCollection<T> GetServices<T>() where T : class;
54 }
55 }