How can I use an IComponentActivator instance for a component, not just specifying a type.
That is, instead of
Component.For<XYZ>.Activator<MyComponentActivator>();
I want to be able say
Component.For<XYZ>.Activator(new MyComponentActivator(someImportantRuntimeInfo));
Also, is there a way I can choose an activator dynamically for a non specifically registered component? That is, I want to have an activator that looks at the type being resolved, decides if it can activate it, and if not, responsibility for activation should be passed on to the default activator.
So basically I want a global IComponentActivator that has the following logic:
Create(Type type){
if (ShouldActivate(type)){
DoActivate(type);
}
else{
// do default activation here somehow
}
}
Thanks!
EDIT
Just use
ILazyComponentLoaderIf you really want to do this, I’d say you can extend the container itself.
ExtendedPropertiesof your component under a well-known keyDefaultKernelCreateComponentActivatormethodIn there return the activator from
ExtendedPropertiesof the componentIContributeComponentModelCreationimplementation that switches the activator to some custom one wen creating your component if you really want to.But the most important question is this: