Class IScopeFactoryExtensions
Defines some extensions for the IScopeFactory interface.
Inheritance
System.Object
IScopeFactoryExtensions
Namespace: Solti.Utils.DI.Interfaces
Assembly: Solti.Utils.DI.Interfaces.dll
Syntax
public static class IScopeFactoryExtensions : Object
Methods
CreateScope(IScopeFactory, out IServiceProvider)
Creates a new scope where the scope is represented by an System.IServiceProvider instane.
Declaration
public static IDisposableEx CreateScope(this IScopeFactory self, out IServiceProvider provider)
Parameters
| Type | Name | Description |
|---|---|---|
| IScopeFactory | self | |
| System.IServiceProvider | provider |
Returns
| Type | Description |
|---|---|
| IDisposableEx |
Remarks
The returned disposable is responsible for releasing the scope instance:
using(IScopeFactory sf = ScopeFactory.Create(svcs => { }, ScopeOptions.Default with { SupportsServiceProvider = true } ))
{
...
using (sf.CreateScope(out IServiceProvider provider))
{
...
}
}