Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong><em>UPDATE</strong> This answer has been updated for SignalR version 1.0</em></p> <p>This is how to build a SignalR <code>IDependencyResolver</code> for Simple Injector:</p> <pre class="lang-cs prettyprint-override"><code>public sealed class SimpleInjectorResolver : Microsoft.AspNet.SignalR.IDependencyResolver { private Container container; private IServiceProvider provider; private DefaultDependencyResolver defaultResolver; public SimpleInjectorResolver(Container container) { this.container = container; this.provider = container; this.defaultResolver = new DefaultDependencyResolver(); } [DebuggerStepThrough] public object GetService(Type serviceType) { // Force the creation of hub implementation to go // through Simple Injector without failing silently. if (!serviceType.IsAbstract &amp;&amp; typeof(IHub).IsAssignableFrom(serviceType)) { return this.container.GetInstance(serviceType); } return this.provider.GetService(serviceType) ?? this.defaultResolver.GetService(serviceType); } [DebuggerStepThrough] public IEnumerable&lt;object&gt; GetServices(Type serviceType) { return this.container.GetAllInstances(serviceType); } public void Register(Type serviceType, IEnumerable&lt;Func&lt;object&gt;&gt; activators) { throw new NotSupportedException(); } public void Register(Type serviceType, Func&lt;object&gt; activator) { throw new NotSupportedException(); } public void Dispose() { this.defaultResolver.Dispose(); } } </code></pre> <p>Unfortunately, there is an issue with the design of the <code>DefaultDependencyResolver</code>. That's why the implementation above does not inherit from it, but wraps it. I created an issue about this on the SignalR site. You can read about it <a href="https://github.com/SignalR/SignalR/issues/400" rel="nofollow">here</a>. Although the designer agreed with me, unfortunately the issue hasn't been fixed in version 1.0.</p> <p>I hope this helps.</p>
 

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