ActivationFactoryInstanceInitializer.cs (1447B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 4 namespace Microsoft.Management.Deployment.Projection 5 { 6 using Microsoft.Management.Deployment.Projection.Initializers; 7 8 /// <summary> 9 /// Activation factory instance initializer requires that: 10 /// - DllGetActivationFactory is exported 11 /// More details: https://github.com/microsoft/CsWinRT/blob/master/docs/hosting.md#exports 12 /// - Host dll file name should be Microsoft.Management.Deployment.dll or a child namespace 13 /// to match the projected classes (e.g. PackageManager) namespace 14 /// More details: https://docs.microsoft.com/en-us/windows/apps/develop/platform/csharp-winrt/#winrt-type-activation 15 /// </summary> 16 public class ActivationFactoryInstanceInitializer : PolicyEnforcedInstanceInitializer 17 { 18 /// <summary> 19 /// In-process context 20 /// </summary> 21 public override ClsidContext Context => ClsidContext.InProc; 22 23 /// <summary> 24 /// Calls default projected class constructor implemented by CsWinRT. 25 /// Default constructor uses DllGetActivationFactory to create an object 26 /// based on the full name of the projected class. 27 /// </summary> 28 /// <typeparam name="T">Projected class type</typeparam> 29 /// <returns>Instance of the provided type.</returns> 30 protected override T CreateInstanceInternal<T>() => new(); 31 } 32 }