title: Simple Injector works without BeginExecutionContextScope, Web Api and OWIN
body: <p>I have a Console application that hosts WebApi(OWIN) project with Simple Injector, and according to <a href="https://simpleinjector.readthedocs.org/en/2.8/owinintegration.html" rel="nofollow">documentation</a> I have to add a few code lines of code to make it work.</p>
  
  <p>But in my case it works even without that configuration, so the question is:
   What I am doing wrong and why it works? </p>
  
  <p>as for me there are two option:
  I thing that something was fixed recently and documentation is not up to date
  OR
  Actually I did something wrong and it might cause a lot of problems in the future.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          var disposable = WebApp.Start&lt;Startup&gt;("http://localhost:8085");
  
          Console.WriteLine("Server Started; Press enter to Quit");
          Console.ReadLine();
      }
  }
  
  public class Startup
  {
      // This method is required by Katana:
      public void Configuration(IAppBuilder app)
      {
          var container = new Container();
  
          //app.Use(async (context, next) =&gt; {
          //    using (container.BeginExecutionContextScope())
          //    {
          //        await next();
          //    }
          //});
  
          container.RegisterWebApiRequest&lt;ITestRepo, TestRepo&gt;();
  
          //container.RegisterWebApiControllers(GlobalConfiguration.Configuration);
  
          container.Verify();
  
          var config = ConfigureWebApi();
  
          config.DependencyResolver =
            new SimpleInjectorWebApiDependencyResolver(container);
  
          //WebApiConfig.Register(config);
          app.UseWebApi(config);
      }
  
      private HttpConfiguration ConfigureWebApi()
      {
          var config = new HttpConfiguration();
          HttpRouteCollectionExtensions.MapHttpRoute(config.Routes, "DefaultApi", "api/{controller}/{id}", new { id = RouteParameter.Optional });
          return config;
      }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public class CompaniesController : ApiController
  {
      private readonly ITestRepo _repo;
  
      public CompaniesController(ITestRepo repo)
      {
          _repo = repo;//i get it here...
      }
  }
  </code></pre>
  
  <p>Is it Ok that it works 
  Thanks 
  Ihor</p>