diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-10-17 02:47:44 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-10-18 13:31:55 -0700 |
| commit | c08fd0aefeea1628fe93c818ca4dde63fd6ac2e1 (patch) | |
| tree | ac63402f6bad7f3a5bc20b088914145d9bf8635b /src/WixToolset.Core/ExtensionManager.cs | |
| parent | 6dd045318f7ee405e92e76d311ad1424c20157c1 (diff) | |
| download | wix-c08fd0aefeea1628fe93c818ca4dde63fd6ac2e1.tar.gz wix-c08fd0aefeea1628fe93c818ca4dde63fd6ac2e1.tar.bz2 wix-c08fd0aefeea1628fe93c818ca4dde63fd6ac2e1.zip | |
Introduce WixToolsetServiceProvider
Using a service provider allows all of WixToolset.Core's internal
functionality to be abstracted behind interfaces in WixToolset.Extensibility.
The service provide can also control what interfaces are singletons.
Diffstat (limited to 'src/WixToolset.Core/ExtensionManager.cs')
| -rw-r--r-- | src/WixToolset.Core/ExtensionManager.cs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/WixToolset.Core/ExtensionManager.cs b/src/WixToolset.Core/ExtensionManager.cs index 7e40571b..b9038c6a 100644 --- a/src/WixToolset.Core/ExtensionManager.cs +++ b/src/WixToolset.Core/ExtensionManager.cs | |||
| @@ -1,6 +1,6 @@ | |||
| 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. | 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 | 2 | ||
| 3 | namespace WixToolset | 3 | namespace WixToolset.Core |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| @@ -8,13 +8,24 @@ namespace WixToolset | |||
| 8 | using System.Linq; | 8 | using System.Linq; |
| 9 | using System.Reflection; | 9 | using System.Reflection; |
| 10 | using WixToolset.Data; | 10 | using WixToolset.Data; |
| 11 | using WixToolset.Extensibility; | 11 | using WixToolset.Extensibility.Services; |
| 12 | 12 | ||
| 13 | public class ExtensionManager : IExtensionManager | 13 | public class ExtensionManager : IExtensionManager |
| 14 | { | 14 | { |
| 15 | private List<Assembly> extensionAssemblies = new List<Assembly>(); | 15 | private List<Assembly> extensionAssemblies = new List<Assembly>(); |
| 16 | 16 | ||
| 17 | /// <summary> | 17 | /// <summary> |
| 18 | /// Adds an assembly. | ||
| 19 | /// </summary> | ||
| 20 | /// <param name="assembly">Assembly to add to the extension manager.</param> | ||
| 21 | /// <returns>The assembly added.</returns> | ||
| 22 | public Assembly Add(Assembly assembly) | ||
| 23 | { | ||
| 24 | this.extensionAssemblies.Add(assembly); | ||
| 25 | return assembly; | ||
| 26 | } | ||
| 27 | |||
| 28 | /// <summary> | ||
| 18 | /// Loads an assembly from a type description string. | 29 | /// Loads an assembly from a type description string. |
| 19 | /// </summary> | 30 | /// </summary> |
| 20 | /// <param name="extension">The assembly type description string.</param> | 31 | /// <param name="extension">The assembly type description string.</param> |
| @@ -57,8 +68,7 @@ namespace WixToolset | |||
| 57 | assembly = ExtensionManager.ExtensionLoadFrom(assemblyName); | 68 | assembly = ExtensionManager.ExtensionLoadFrom(assemblyName); |
| 58 | } | 69 | } |
| 59 | 70 | ||
| 60 | this.extensionAssemblies.Add(assembly); | 71 | return this.Add(assembly); |
| 61 | return assembly; | ||
| 62 | } | 72 | } |
| 63 | 73 | ||
| 64 | /// <summary> | 74 | /// <summary> |
