Search Results for

    Show / Hide Table of Contents
    View Source

    Class CoreScope

    Represents a core scope that manages transactional operations, caching, locking, and notifications.

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.Scoping
    Assembly: Umbraco.Core.dll
    Syntax
    public class CoreScope : ICoreScope, IInstanceIdentifiable
    Remarks

    Scopes can be nested; a child scope must be completed before its parent.

    The scope manages file system scoping, isolated caches, and notification publishing.

    Constructors

    View Source

    CoreScope(IDistributedLockingMechanismFactory, ILoggerFactory, FileSystems, IEventAggregator, RepositoryCacheMode, bool?, IScopedNotificationPublisher?)

    Initializes a new instance of the CoreScope class as a root scope.

    Declaration
    protected CoreScope(IDistributedLockingMechanismFactory distributedLockingMechanismFactory, ILoggerFactory loggerFactory, FileSystems scopedFileSystem, IEventAggregator eventAggregator, RepositoryCacheMode repositoryCacheMode = RepositoryCacheMode.Unspecified, bool? shouldScopeFileSystems = null, IScopedNotificationPublisher? notificationPublisher = null)
    Parameters
    Type Name Description
    IDistributedLockingMechanismFactory distributedLockingMechanismFactory

    The factory for creating distributed locking mechanisms.

    ILoggerFactory loggerFactory

    The logger factory for creating loggers.

    FileSystems scopedFileSystem

    The file systems to potentially scope.

    IEventAggregator eventAggregator

    The event aggregator for publishing notifications.

    RepositoryCacheMode repositoryCacheMode

    The repository cache mode for this scope.

    bool? shouldScopeFileSystems

    A value indicating whether to scope the file systems.

    IScopedNotificationPublisher notificationPublisher

    An optional scoped notification publisher.

    View Source

    CoreScope(ICoreScope?, IDistributedLockingMechanismFactory, ILoggerFactory, FileSystems, IEventAggregator, RepositoryCacheMode, bool?, IScopedNotificationPublisher?)

    Initializes a new instance of the CoreScope class with an optional parent scope.

    Declaration
    protected CoreScope(ICoreScope? parentScope, IDistributedLockingMechanismFactory distributedLockingMechanismFactory, ILoggerFactory loggerFactory, FileSystems scopedFileSystem, IEventAggregator eventAggregator, RepositoryCacheMode repositoryCacheMode = RepositoryCacheMode.Unspecified, bool? shouldScopeFileSystems = null, IScopedNotificationPublisher? notificationPublisher = null)
    Parameters
    Type Name Description
    ICoreScope parentScope

    The parent scope, or null if this is a root scope.

    IDistributedLockingMechanismFactory distributedLockingMechanismFactory

    The factory for creating distributed locking mechanisms.

    ILoggerFactory loggerFactory

    The logger factory for creating loggers.

    FileSystems scopedFileSystem

    The file systems to potentially scope.

    IEventAggregator eventAggregator

    The event aggregator for publishing notifications.

    RepositoryCacheMode repositoryCacheMode

    The repository cache mode for this scope.

    bool? shouldScopeFileSystems

    A value indicating whether to scope the file systems.

    IScopedNotificationPublisher notificationPublisher

    An optional scoped notification publisher.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when the repository cache mode is lower than the parent's mode, when a notification publisher is specified on a nested scope, or when the file system scoping differs from the parent.

    Fields

    View Source

    Completed

    Indicates whether the scope has been completed.

    Declaration
    protected bool? Completed
    Field Value
    Type Description
    bool?
    Remarks

    TODO (V18): Rename to _completed to comply with SA1306 (field names should begin with lowercase), or consider converting to a property.

    Properties

    View Source

    CreatedThreadId

    Gets the managed thread ID on which this instance was created.

    Declaration
    public int CreatedThreadId { get; }
    Property Value
    Type Description
    int
    View Source

    Depth

    Gets the distance from the root scope.

    Declaration
    public int Depth { get; }
    Property Value
    Type Description
    int
    Remarks

    A zero represents a root scope, any value greater than zero represents a child scope.

    View Source

    HasParentScope

    Gets a value indicating whether this scope has a parent scope.

    Declaration
    protected bool HasParentScope { get; }
    Property Value
    Type Description
    bool
    View Source

    InstanceId

    Gets the instance unique identifier.

    Declaration
    public Guid InstanceId { get; }
    Property Value
    Type Description
    Guid
    View Source

    IsolatedCaches

    Gets the scope isolated cache.

    Declaration
    public IsolatedCaches IsolatedCaches { get; }
    Property Value
    Type Description
    IsolatedCaches
    View Source

    Locks

    Gets the locking mechanism for this scope.

    Declaration
    public ILockingMechanism Locks { get; }
    Property Value
    Type Description
    ILockingMechanism
    View Source

    Notifications

    Gets the scope notification publisher

    Declaration
    public IScopedNotificationPublisher Notifications { get; }
    Property Value
    Type Description
    IScopedNotificationPublisher
    View Source

    RepositoryCacheMode

    Gets the repositories cache mode.

    Declaration
    public RepositoryCacheMode RepositoryCacheMode { get; }
    Property Value
    Type Description
    RepositoryCacheMode
    View Source

    ScopedFileSystems

    Gets a value indicating whether file systems are scoped for this scope.

    Declaration
    public bool ScopedFileSystems { get; }
    Property Value
    Type Description
    bool

    Methods

    View Source

    ChildCompleted(bool?)

    Called when a child scope has completed, to update the parent's completion status.

    Declaration
    protected void ChildCompleted(bool? completed)
    Parameters
    Type Name Description
    bool? completed

    A value indicating whether the child completed successfully.

    View Source

    Complete()

    Completes a scope

    Declaration
    public bool Complete()
    Returns
    Type Description
    bool

    A value indicating whether the scope is completed or not.

    View Source

    Dispose()

    Disposes the scope, handling file systems, notifications, and parent scope completion.

    Declaration
    public virtual void Dispose()
    View Source

    EagerReadLock(params int[])

    Eagerly acquires read locks on the specified lock objects.

    Declaration
    public void EagerReadLock(params int[] lockIds)
    Parameters
    Type Name Description
    int[] lockIds

    Array of lock object identifiers.

    View Source

    EagerReadLock(TimeSpan, int)

    Eagerly acquires a read lock on a lock object with a timeout.

    Declaration
    public void EagerReadLock(TimeSpan timeout, int lockId)
    Parameters
    Type Name Description
    TimeSpan timeout

    The database timeout.

    int lockId

    The lock object identifier.

    View Source

    EagerWriteLock(params int[])

    Eagerly acquires write locks on the specified lock objects.

    Declaration
    public void EagerWriteLock(params int[] lockIds)
    Parameters
    Type Name Description
    int[] lockIds

    Array of lock object identifiers.

    View Source

    EagerWriteLock(TimeSpan, int)

    Eagerly acquires a write lock on a lock object with a timeout.

    Declaration
    public void EagerWriteLock(TimeSpan timeout, int lockId)
    Parameters
    Type Name Description
    TimeSpan timeout

    The database timeout.

    int lockId

    The lock object identifier.

    View Source

    HandleScopedFileSystems()

    Handles the completion and disposal of scoped file systems.

    Declaration
    protected void HandleScopedFileSystems()
    View Source

    HandleScopedNotifications()

    Handles the scoped notifications when the scope exits.

    Declaration
    protected void HandleScopedNotifications()
    View Source

    ReadLock(params int[])

    Read-locks some lock objects.

    Declaration
    public void ReadLock(params int[] lockIds)
    Parameters
    Type Name Description
    int[] lockIds

    Array of lock object identifiers.

    View Source

    ReadLock(TimeSpan, int)

    Read-locks some lock objects.

    Declaration
    public void ReadLock(TimeSpan timeout, int lockId)
    Parameters
    Type Name Description
    TimeSpan timeout

    The database timeout in milliseconds

    int lockId

    The lock object identifier.

    View Source

    SetParentScope(ICoreScope)

    Sets the parent scope for this scope.

    Declaration
    protected void SetParentScope(ICoreScope coreScope)
    Parameters
    Type Name Description
    ICoreScope coreScope

    The parent scope to set.

    View Source

    WriteLock(params int[])

    Write-locks some lock objects.

    Declaration
    public void WriteLock(params int[] lockIds)
    Parameters
    Type Name Description
    int[] lockIds

    Array of object identifiers.

    View Source

    WriteLock(TimeSpan, int)

    Write-locks some lock objects.

    Declaration
    public void WriteLock(TimeSpan timeout, int lockId)
    Parameters
    Type Name Description
    TimeSpan timeout

    The database timeout in milliseconds

    int lockId

    The lock object identifier.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX