How to set PartCreationPolicy using custom attribute

Apr 18, 2010 at 7:15 PM

how can I define the PartCreationPolicy of the export

using cusrom attribute?, so the consumer of this attribute won't have to

declare it.

I'm looking for something like the following idea

[PartCreationPolicy(CreationPolicy.NonShared)]
public class CustomExoprt: ExportAttribute
{
}

Apr 18, 2010 at 9:31 PM
You cannot do this. PartCreationPolicy relates to the part not the export. The one thing you can do is create a custom ImportAttribute and set the required creation policy in that attribute.

We have considered in the future having an InheritedPartCreationPolicy attribute in the future that you could apply on the base and possibly a custom attribute as long as it is a class only export. Would that address your need?