IServiceScopeFactory.CreateScope 方法

定义

创建一个 IServiceScope,其中包含用于解析新创建的作用域中的依赖项的 IServiceProviderCreate an IServiceScope which contains an IServiceProvider used to resolve dependencies from a newly created scope.

public:
 Microsoft::Extensions::DependencyInjection::IServiceScope ^ CreateScope();
public Microsoft.Extensions.DependencyInjection.IServiceScope CreateScope ();
abstract member CreateScope : unit -> Microsoft.Extensions.DependencyInjection.IServiceScope
Public Function CreateScope () As IServiceScope

返回

IServiceScope

控制作用域生存期的 IServiceScopeAn IServiceScope controlling the lifetime of the scope. 它被释放后,所有已从 ServiceProvider 解析的作用域内服务都将被释放。Once this is disposed, any scoped services that have been resolved from the ServiceProvider will also be disposed. ..

适用于