Questions about System.AddIn RRS feed

  • Question

  • I have been looking at System.AddIn as a means of implementing an extensible application. I have been looking all over the Web for information and have spent lots of time reading postings on the CLR AddIn Team Blog. Unfortunately, most of the examples are fairly trivial and none of them deal with building an application that wants to expose a customer-facing API for the host and its addins.

    In my experiments so far, I have encountered a couple of things that I can't seem to get around:

    1) If an AddIn implements multiple contracts (say "IAddin" and "IHostedAddin"), is there any way for the host to cast a handle to one interface to a handle of the other type? For example, I find and activate the AddIn using the IHostedAddin contract, and now that I have an instance activated, I want a handle of type "IAddin" to that same, already activated instance. These two contracts do not derive from each other - they provide independent features (IHostedAddin provides a generic mechanism for the host to manipulate all addins, whereas IAddin provides features that my host might want to expose to a customer via a public API). I have worked around this problem so far by providing an explicit property on the IHostedAddin interface that returns an IAddin interface, but this seems cumbersome. I'm looking for a more elegant way where I don't have to provide explicit accessors for every possible interface.

    2) The application I am building exposes a rich, customer-facing API. One thing I need to be able to do is to allow a programmatic user access to the full feature set of each AddIn. The host application does not know ahead of time what the feature set of the AddIn might be. How do I give the programmatic user a handle to "IFullFeaturedAddin" (the public API defined by the AddIn) without apriori knowledge of what that interface might be?

    Thanks for any insight anyone can provide to a System.AddIn rookie...
    Monday, October 13, 2008 9:07 PM


All replies