v10 make migration from v9 less painful WRT IScope (#12293)

* Restore IEventDispatcher

* Fix breaking changes WRT IScopeProvider and IScope

* Update internal usage.

* Update src/Umbraco.Core/Services/UserService.cs

* Better obsolete message

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
This commit is contained in:
Paul Johnson
2022-04-26 10:22:37 +01:00
committed by GitHub
parent ef128f9fab
commit 95aa143db0
157 changed files with 2016 additions and 912 deletions

View File

@@ -136,7 +136,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
// gets a scope contextual representing a locked writer to the dictionary
// TODO: GetScopedWriter? should the dict have a ref onto the scope provider?
public IDisposable? GetScopedWriteLock(IScopeProvider scopeProvider)
public IDisposable? GetScopedWriteLock(ICoreScopeProvider scopeProvider)
{
return ScopeContextualBase.Get(scopeProvider, _instanceId, scoped => new ScopedWriteLock(this, scoped));
}

View File

@@ -43,7 +43,7 @@ namespace Umbraco.Extensions
// TODO: Gotta wonder how much this does actually improve perf? It's a lot of weird code to make this happen so hope it's worth it
builder.Services.AddUnique<IIdKeyMap>(factory =>
{
var idkSvc = new IdKeyMap(factory.GetRequiredService<IScopeProvider>(), factory.GetRequiredService<IScopeAccessor>());
var idkSvc = new IdKeyMap(factory.GetRequiredService<ICoreScopeProvider>(), factory.GetRequiredService<IScopeAccessor>());
if (factory.GetRequiredService<IPublishedSnapshotService>() is PublishedSnapshotService publishedSnapshotService)
{
idkSvc.SetMapper(UmbracoObjectTypes.Document, id => publishedSnapshotService.GetDocumentUid(id), uid => publishedSnapshotService.GetDocumentId(uid));

View File

@@ -698,7 +698,7 @@ AND cmsContentNu.nodeId IS NULL
}
}
public ContentNodeKit GetMediaSource(IDatabaseScope scope, int id)
public ContentNodeKit GetMediaSource(Scoping.IScope scope, int id)
{
var sql = SqlMediaSourcesSelect()
.Append(SqlObjectTypeNotTrashed(SqlContext, Constants.ObjectTypes.Media))

View File

@@ -25,7 +25,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Persistence
public NuCacheContentService(
INuCacheContentRepository repository,
IKeyValueService keyValueService,
IScopeProvider provider,
ICoreScopeProvider provider,
ILoggerFactory loggerFactory,
IProfilingLogger profilingLogger,
IEventMessagesFactory eventMessagesFactory,
@@ -119,7 +119,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Persistence
IReadOnlyCollection<int>? mediaTypeIds = null,
IReadOnlyCollection<int>? memberTypeIds = null)
{
using (IScope scope = ScopeProvider.CreateScope(repositoryCacheMode: RepositoryCacheMode.Scoped))
using (ICoreScope scope = ScopeProvider.CreateCoreScope(repositoryCacheMode: RepositoryCacheMode.Scoped))
{
scope.ReadLock(Constants.Locks.ContentTree);
@@ -139,7 +139,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Persistence
/// <inheritdoc/>
public bool VerifyContentDbCache()
{
using IScope scope = ScopeProvider.CreateScope(autoComplete: true);
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
scope.ReadLock(Constants.Locks.ContentTree);
return _repository.VerifyContentDbCache();
}
@@ -147,7 +147,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Persistence
/// <inheritdoc/>
public bool VerifyMediaDbCache()
{
using IScope scope = ScopeProvider.CreateScope(autoComplete: true);
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
scope.ReadLock(Constants.Locks.MediaTree);
return _repository.VerifyMediaDbCache();
}
@@ -155,7 +155,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Persistence
/// <inheritdoc/>
public bool VerifyMemberDbCache()
{
using IScope scope = ScopeProvider.CreateScope(autoComplete: true);
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
scope.ReadLock(Constants.Locks.MemberTree);
return _repository.VerifyMemberDbCache();
}

View File

@@ -38,7 +38,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
private readonly IVariationContextAccessor _variationContextAccessor;
private readonly IProfilingLogger _profilingLogger;
private readonly IScopeProvider _scopeProvider;
private readonly Scoping.IScopeProvider _scopeProvider;
private readonly INuCacheContentService _publishedContentService;
private readonly ILogger<PublishedSnapshotService> _logger;
private readonly ILoggerFactory _loggerFactory;
@@ -85,7 +85,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
IVariationContextAccessor variationContextAccessor,
IProfilingLogger profilingLogger,
ILoggerFactory loggerFactory,
IScopeProvider scopeProvider,
Scoping.IScopeProvider scopeProvider,
INuCacheContentService publishedContentService,
IDefaultCultureAccessor defaultCultureAccessor,
IOptions<GlobalSettings> globalSettings,

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
@@ -108,7 +108,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
// the dict is write-locked until the write-lock is released
// which happens when it is disposed (non-scoped)
// or when the scope context exits (scoped)
public IDisposable? GetScopedWriteLock(IScopeProvider scopeProvider)
public IDisposable? GetScopedWriteLock(ICoreScopeProvider scopeProvider)
{
return ScopeContextualBase.Get(scopeProvider, _instanceId, scoped => new ScopedWriteLock(this, scoped));
}