add-in constructor

Mar 27, 2008 at 1:15 PM
Does the framework require an add-in to have a no-argument constructor? I'm currently working on a project in which I need to pass in some external object to an add-in via the constructor, but in this case the add-in cannot be discovered and activated. Is there any way to work this around?
Mar 27, 2008 at 10:50 PM
The framework requires, and only uses, the no-argument constructor in add-ins. The reason for this is that there is no way to specify the parameters to a constructor in a contract. The general pattern we recomend is for add-ins that need initialization data you add an "Initialize" method to the add-in view type with which-ever parameters you need.

Does that make sense?

--Jesse
Mar 28, 2008 at 1:13 AM

JesseKaplan wrote:
The framework requires, and only uses, the no-argument constructor in add-ins. The reason for this is that there is no way to specify the parameters to a constructor in a contract. The general pattern we recomend is for add-ins that need initialization data you add an "Initialize" method to the add-in view type with which-ever parameters you need.

Does that make sense?

--Jesse


Yes it makes sense, thank you for the help.