Interface IScopeProvider
Provides scopes.
Namespace: Umbraco.Core.Scoping
Assembly: Umbraco.Core.dll
Syntax
public interface IScopeProvider
Properties
View SourceContext
Gets the scope context.
Declaration
IScopeContext Context { get; }
Property Value
Type | Description |
---|---|
IScopeContext |
SqlContext
Gets the sql context.
Declaration
ISqlContext SqlContext { get; }
Property Value
Type | Description |
---|---|
ISqlContext |
Methods
View SourceAttachScope(IScope, Boolean)
Attaches a scope.
Declaration
void AttachScope(IScope scope, bool callContext = false)
Parameters
Type | Name | Description |
---|---|---|
IScope | scope | The scope to attach. |
System.Boolean | callContext | A value indicating whether to force usage of call context. |
Remarks
Only a scope created by CreateDetachedScope(IsolationLevel, RepositoryCacheMode, IEventDispatcher, Nullable<Boolean>) can be attached.
CreateDetachedScope(IsolationLevel, RepositoryCacheMode, IEventDispatcher, Nullable<Boolean>)
Creates a detached scope.
Declaration
IScope CreateDetachedScope(IsolationLevel isolationLevel = IsolationLevel.Unspecified, RepositoryCacheMode repositoryCacheMode = RepositoryCacheMode.Unspecified, IEventDispatcher eventDispatcher = null, bool? scopeFileSystems = null)
Parameters
Type | Name | Description |
---|---|---|
System.Data.IsolationLevel | isolationLevel | The transaction isolation level. |
RepositoryCacheMode | repositoryCacheMode | The repositories cache mode. |
IEventDispatcher | eventDispatcher | An optional events dispatcher. |
System.Nullable<System.Boolean> | scopeFileSystems | A value indicating whether to scope the filesystems. |
Returns
Type | Description |
---|---|
IScope | A detached scope. |
Remarks
A detached scope is not ambient and has no parent.
It is meant to be attached by AttachScope(IScope, Boolean).
CreateScope(IsolationLevel, RepositoryCacheMode, IEventDispatcher, Nullable<Boolean>, Boolean, Boolean)
Creates an ambient scope.
Declaration
IScope CreateScope(IsolationLevel isolationLevel = IsolationLevel.Unspecified, RepositoryCacheMode repositoryCacheMode = RepositoryCacheMode.Unspecified, IEventDispatcher eventDispatcher = null, bool? scopeFileSystems = null, bool callContext = false, bool autoComplete = false)
Parameters
Type | Name | Description |
---|---|---|
System.Data.IsolationLevel | isolationLevel | The transaction isolation level. |
RepositoryCacheMode | repositoryCacheMode | The repositories cache mode. |
IEventDispatcher | eventDispatcher | An optional events dispatcher. |
System.Nullable<System.Boolean> | scopeFileSystems | A value indicating whether to scope the filesystems. |
System.Boolean | callContext | A value indicating whether this scope should always be registered in the call context. |
System.Boolean | autoComplete | A value indicating whether this scope is auto-completed. |
Returns
Type | Description |
---|---|
IScope | The created ambient scope. |
Remarks
The created scope becomes the ambient scope.
If an ambient scope already exists, it becomes the parent of the created scope.
When the created scope is disposed, the parent scope becomes the ambient scope again.
Parameters must be specified on the outermost scope, or must be compatible with the parents.
Auto-completed scopes should be used for read-only operations ONLY. Do not use them if you do not understand the associated issues, such as the scope being completed even though an exception is thrown.
DetachScope()
Detaches a scope.
Declaration
IScope DetachScope()
Returns
Type | Description |
---|---|
IScope | The detached scope. |
Remarks
Only a scope previously attached by AttachScope(IScope, Boolean) can be detached.