title: Getting Reference to StructureMap Container
body: <p>I'm new to StructureMap and have a scenario where I would like to get a handle to the container.</p>
  
  <p>I am building a Web API service initializing StructureMap container in Application_Start of Global.asax</p>
  
  <pre><code>IContainer container = IoC.Initialize();
  GlobalConfiguration.Configuration.DependencyResolver = new MyDependencyResolver(container);
  </code></pre>
  
  <p>But want to access container within my controllers to get instances to objects in the container.</p>
  
  <p>I know I can call container.GetInstance and specify the type to get, but since I am not using ObjectFactory and initialized the container in Global.asax, I don't know a way to access it within my controllers.</p>
  
  <p>What is the best way of passing the reference to container from Global.asax to rest of the application code?</p>
  
  <p>Thanks,
  Jay.</p>