simpleinjector / SimpleInjector.Integration.AspNetCore

MIT License
2 stars 3 forks source link

Add AddControllerActivation(Lifestyle) overload #8

Closed dotnetjunkie closed 3 years ago

dotnetjunkie commented 3 years ago

The AddControllerActivation method registers controllers with the transient lifestyle. This typically works well, but leads to complications whenever users decide to implement IDisposable on them. Registering controllers as Scoped lead to difficulties under Simple Injector v4, but in v5 the standard Lifestyle Mismatch behavior has been loosened, making is possible for Scoped components to depend on Transient.

Adding an AddControllerActivation(Lifestyle) overload would, therefore, make life easier for those developers.

dotnetjunkie commented 3 years ago

feature-8 branch created.