0
gunpal5 created
Hello,
How to register Scoped dependencies? I can't find a way to do it with ABP framework. It only supports Singleton or Transient. Is there any simple way of defining Scoped dependencies?
Regards, Gunpal Jain
1 Answer(s)
-
0
Answered in this SO question: Castle Windsor lifestyle in .NET Core web application
<cite>hikalkan: </cite>
ASP.NET Core has its own 'scoped' lifecycle, which is 'per request'. See its documentation: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection
Usage example:
services.AddScoped<ICharacterRepository, CharacterRepository>();
You should do it inside ConfigureServices method in Startup class.
Also answered in this issue: Equivalent to ServiceCollection.AddScoped<> in IocManager
IocManager.IocContainer.Register(Component.For<TestService>() .LifestyleCustom<MsScopedLifestyleManager>());