Use of Assembly Attributes

S

Shalom Shachne

We have been trying to mimic a sort of "plug-in" design with our
app. We are loading assemblies which are in the app's assembly
directory and then iterating all the Types in each Assembly to find
ones which match the plug-in loaders designated type.

I was thinking of perhaps trying to use Assembly Attributes to mark
the plugin Assembly(ies) so that we don't bother iterating the types
from other assemblies which we know wouldn't contain the "plugin".

It seems like there is a Product Info Assembly Attribute, that maybe
could be used for this purpose.

I'm not totally sure that this is a necessary or good idea. It seems
to iterate all the other assembly's types very quickly - so maybe this
is an unecessary optimization.

I would welcome any thoughts or suggestions.
 
J

Jeff Johnson

AFAIK, the hard (i.e. slow) part is loading the assembly. So if you have
to load the assembly just to inspect the attribute, that's probably not
significantly better than just iterating over the types in the assembly.

Perhaps this would be where you'd want to use the ReflectionOnlyLoad[From]()
method.
If you do choose to use an attribute, I would implement your own attribute
specifically for the purpose, rather than reusing an existing one.

Agreed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top