Isn't this what MEF was made for?
Anyways what we do:
[AttributeUsage(AttributeTargets.Assembly, Inherited = false,
AllowMultiple = false)]
public sealed class ComponentRegistrarAttribute : Attribute {
private readonly Type _componentRegistrarClass;
public ComponentRegistrarAttribute(Type componentRegistrarClass) {
_componentRegistrarClass = componentRegistrarClass;
}
public IComponentRegistrar GetRegistrar() {
return (IComponentRegistrar)
Activator.CreateInstance(_componentRegistrarClass);
}
}
public interface IComponentRegistrar {
void AddComponentsTo(IWindsorContainer container);
}
Then at app startup we iterate over all assemblies in the bin folder and
look for that attribute on the class. If it exists, we call GetRegistrar
on it and pass it the container to register components into.
Yannis wrote:
> AllTypes.Of<IPlugin> will only register the IPlugins in the current
> assembly no?
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---