Created MetadataAttribute
that allows using multiple.
[MetadataAttribute]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class BusinessLogicMetaDataAttribute : ExportAttribute, IBusinessLogicMetaData
{
//......
}
then I am using GetExports<T>()
to import methods.
//.....
var imported = _container.GetExports<Action<object, EvantArgs>, IBusinessLogicMetaData>("myplugin");
//.....
Here is my plugin method:
[BusinessLogicMetaData("myplugin")]
[BusinessLogicMetaData("myplugin1")]
public void Test(object sender, EventArgs e)
{
//....
}
Get exports is not returning the plugin method because of AlowMultiple=true
in my MetadataAttribute
. It works fine if I set my metadataAttribute to AllowMultiple = false and remove the second attribute of the plugin method.
Why I can't have two attributes on my plugin method?
Thanks for the help!