This project has moved. For the latest updates, please go here.

Declaring Additional Attributes on a Custom Export Attribute

Aug 29, 2009 at 5:37 PM

I would like to be able to declare other attributes (not just metadataAttributeAttribute) on custom export providers.  I don't think this works at present, and it would really clean up client code. As an example, I have a custom export attribute to provide some metadata (or the capacity to add metadata in the future). The part is alson non_Shared. I know this logically from the declaration name and intended usage. I don't want to require implementing programmers to remember to set the creation policy, and I don't want to use a derived type for the implmeentation. I just want to implement the custom export attribute and hide the rest of MEF.

- Can we do this and I am just messing something else up?

- If we can't do this, I want to ask for it in VNext.

And I earlier asked to be able to put a creation policy on an interface, and Glenn mentioned that the interface doesn't have a lifetime. That is true, but the interface defines a contract that often has only a single logical lifetime. So I would like to ask for this again.

I realize that neither are straight up easy with the current attribute approach.