Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Edit:</strong> As James Bradt mentions in his post below, the Autofac package has now been updated to fix this issue, so anyone coming across this thread in the future should probably try the new package first :)</p> <p>Basically, with the new package you just need to do this in your global.asax.cs:</p> <pre><code>GlobalConfiguration.Configuration.DependencyResolver = new Autofac.Integration.WebApi.AutofacWebApiDependencyResolver(container); </code></pre> <p><strong>/Edit</strong></p> <p>I just came across the same issue - I was able to resolve it in my situation by creating a simple IDependencyResolver implementation that wraps the existing AutofacDependencyResolver.</p> <p>As the class name suggests, I'm treating this as a temporary resolution - the BeginScope and Dispose methods will need some work and are obviously not suitable for a production environment but this allows me to continue development until a proper solution emerges.</p> <p>So, with those caveats, the IDependencyResolver implementation looks like this:</p> <pre><code>public class TemporaryDependencyResolver : IDependencyResolver { private readonly AutofacDependencyResolver _autofacDependencyResolver; public TemporaryDependencyResolver(AutofacDependencyResolver autofacDependencyResolver) { _autofacDependencyResolver = autofacDependencyResolver; } public void Dispose() { } public object GetService(Type serviceType) { return _autofacDependencyResolver.GetService(serviceType); } public IEnumerable&lt;object&gt; GetServices(Type serviceType) { return _autofacDependencyResolver.GetServices(serviceType); } public IDependencyScope BeginScope() { return this; } } </code></pre> <p>and I set it like this in Global.asax.cs:</p> <pre><code>var container = builder.Build(); var resolver = new AutofacDependencyResolver(container); GlobalConfiguration.Configuration.DependencyResolver = new TemporaryDependencyResolver(resolver); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload