Where to put the Container?

Viewed 481

I'm experimenting with IoC in my Web App and would like to do things according to best practices. Recently I discovered an IoC framework called DryIoc which is supposed to be small and fast.

I've read through the examples but none seem to point out where I should put the container itself.

Should it reside in the controller? Or in Global.asax? Someplace else maybe? Or perhaps as a static variable in a class?

I'd appreciate if someone would be able to guide me in the right direction, preferrably with some sample code, as I've stalled and don't got a clue on how to continue.

var container = new Container();   // Should obviously NOT be a local variable

container.Register<ISalesAgentRepository, SalesAgentRepository>(Reuse.Singleton);
2 Answers
Related