I am learning epi 7, and have some example code. I have an initializable module to register events:
class EventsIntegration : IInitializableModule
[ImportingConstructor] public EventsIntegration ([ImportMany] IPageAction eventActions)
The IPageAction interface have [InheritedExport] attribute on it.
The problem is when I'm running on the old site using epi 6, everything just works fine. But when I migrate this code to epi7, it throws exception: Constructor of type 'xxxx' not found. Removing the attribute for mef, it works again but using the default constructor.
So any advice that I'm missing configurations or stuff like that?Best regards,
Not sure if I looked at right place, but at sourc code I can find that v7 does not create initializable module instances via MEF anymore. It uses just Activator.CreateInstance. By passing null as second argument - .Net class loader will look for default parameterless constructor.
@Valdis Iljuconoks: thanks for the reply, but hmm not sure how to quote in the forum.
From the exception trace I also see Activator trying to create instance. So how should I implement a similar feature to MEF :)
You want to "import" (or resolve dependencies) something into a module itself? You could try to get it from ServiceLocator. That guy should be initialized already.
Sorry for the late reply, as I was using autofac, I changed the way my module initialize and inject the properties later, so it's working now
Thanks for the help :)Dan Le