I'm very new to DotNetNuke module development but fairly well versed in StructureMap as an IoC container and the concepts of IoC and Dependency Injection.
I'm following the DNN module tutorial vids here - http://www.dotnetnuke.com/Resources/Video-Library.aspx - but I can't quite figure out where I would do my StructureMap initialization.
Within the framework of DNN module development, where do I do this?
There isn't a good place to do one time initialization like that in DotNetNuke. DNN doesn't give a clean hook into the Application_Start
event.
One approach that we've taken is to implement an HttpModule
that does the initialization, with a lock to ensure it just happens once. Ian Robinson had an example of that in his Beer Collection MVP sample module, but appears to have torn it out somewhat. One problem with this approach is that it requires a request through the pipeline to setup everything. We've seen cases where a scheduled task (which doesn't run in the context of a request) was able to start without this initialization, and then blow up because it didn't have any dependencies.