Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SignalR Core integration package #783

Open
dotnetjunkie opened this issue Dec 4, 2019 · 1 comment
Open

Add SignalR Core integration package #783

dotnetjunkie opened this issue Dec 4, 2019 · 1 comment
Labels
Milestone

Comments

@dotnetjunkie
Copy link
Collaborator

@dotnetjunkie dotnetjunkie commented Dec 4, 2019

This package should do the following:

  • Implement a SimpleInjectorHubActivator<T> class
  • Add an extension method for registration of this class
  • Add an extension method that allows auto-registration of Hub classes, similar to the RegisterMvcControllers of the ASP.NET Core MVC integration package. i.e. it should register Hub classes based on the selected lifestyle (ILifestyleSelectionBehavior) and should suppress the disposable transient components warning in case the Hub implementation does not override Dispose(bool).

Especially this last point is the main reason why we need an integration package. Integrating SignalR without an integration package would have been trivial in case Hub would not have implemented IDisposable (and it shouln't have).

There are other complications, such as discussed here that should be taken into consideration, which are:

  • Hub classes do not always run in a web request (for instance with LongPolling), which means that they can be resolved without an active Simple Injector Scope.
  • This means SimpleInjectorHubActivator<T> must create a new Scope within its Create method, and dispose of the Scope in the Release method.
  • Although the creation of, and disposing of a scope, could be skipped in case an active scope (i.e. a web request scope) already exists, that could lead to complications, because the request might already have ended in some cases.
  • In case the absense of an active scope, the hub activator should be able to supply the Simple Injector ASP.NET Core integration with the active IServiceScope/IServiceProvider instance to prevent Simple Injector from creating a new IServiceScope internal, which would, again, lead to multiple instances of scoped registrations, but now for ASP.NET Core registered types. The hub should run in its own Simple Injector scope and MS.DI scope; reusing the same incoming MS.DI scope might have hard to predict side effects.

The following issues should be taken into consideration:

@dotnetjunkie

This comment has been minimized.

Copy link
Collaborator Author

@dotnetjunkie dotnetjunkie commented Jan 7, 2020

For now, we made the decision not to add an integration package. This page describes how to integrate Simple Injector with SignalR Core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.