I need to pass configuration settings to an AddIn created using the Managed AddIn Framework (MAF, aka System.AddIn). Can a put a settings parameter in the AddIn's constructor?
Another option would be to create an Initialize() method, but then I have to remember to call it before doing any work with the AddIn.
最好的方法是使用Initalize()方法,因为管道使用构造函数参数来传递契约。
I too use an Initialize() method in my add-ins. Indeed System.AddIn invokes the parameterless constructor of the add-in class.
Here is an explanation of what goes on during the activation of an add-in. It is an old post but the activation process is still the same. You can also check the source code of the System.AddIn assembly from Microsoft's Shared Source Initiative . You can download the one with Product Name = .Net and Version = 4 for Framework 4, install it and then look for AddInToken.cs (it will lead you to AddInActivator.cs).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.