main
cs 43 lines 1.35 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.Core.WindowsInstaller
4 {
5 using WixToolset.Core.WindowsInstaller.Bind;
6 using WixToolset.Extensibility;
7 using WixToolset.Extensibility.Data;
8 using WixToolset.Extensibility.Services;
9
10 internal class MsmBackend : IBackend
11 {
12 public IBindResult Bind(IBindContext context)
13 {
14 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>();
15
16 var backendExtensions = extensionManager.GetServices<IWindowsInstallerBackendBinderExtension>();
17
18 foreach (var extension in backendExtensions)
19 {
20 extension.PreBackendBind(context);
21 }
22
23 IBindResult result = null;
24 try
25 {
26 var command = new BindDatabaseCommand(context, backendExtensions);
27 result = command.Execute();
28
29 foreach (var extension in backendExtensions)
30 {
31 extension.PostBackendBind(result);
32 }
33
34 return result;
35 }
36 catch
37 {
38 result?.Dispose();
39 throw;
40 }
41 }
42 }
43 }