From 5e2f26ac9b40f5e658d0ef996251df320d7e84ea Mon Sep 17 00:00:00 2001 From: Paul Johnson Date: Thu, 28 Apr 2022 11:55:22 +0100 Subject: [PATCH] Undo some easy to resolve (no longer netstd2.0 TFM) breaking changes (#12316) * Undo some easy to resolve (no longer netstd2.0 TFM) breaking changes * Restore missing ctor to PublishedSnapshotServiceEventHandler --- .../Persistence/DbProviderFactoryCreator.cs | 17 +++++++++++++++++ .../Persistence/IDbProviderFactoryCreator.cs | 5 ++++- .../Persistence/IUmbracoDatabaseFactory.cs | 6 +++++- .../Persistence/SqlSyntax/ISqlSyntaxProvider.cs | 5 +++-- .../PublishedSnapshotServiceEventHandler.cs | 12 ++++++++++++ 5 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Infrastructure/Persistence/DbProviderFactoryCreator.cs b/src/Umbraco.Infrastructure/Persistence/DbProviderFactoryCreator.cs index 59e8e9c386..0177475609 100644 --- a/src/Umbraco.Infrastructure/Persistence/DbProviderFactoryCreator.cs +++ b/src/Umbraco.Infrastructure/Persistence/DbProviderFactoryCreator.cs @@ -16,6 +16,23 @@ namespace Umbraco.Cms.Infrastructure.Persistence private readonly IDictionary _bulkSqlInsertProviders; private readonly IDictionary _providerSpecificMapperFactories; + [Obsolete("Please use an alternative constructor.")] + public DbProviderFactoryCreator( + Func getFactory, + IEnumerable syntaxProviders, + IEnumerable bulkSqlInsertProviders, + IEnumerable databaseCreators, + IEnumerable providerSpecificMapperFactories) + : this( + getFactory, + syntaxProviders, + bulkSqlInsertProviders, + databaseCreators, + providerSpecificMapperFactories, + Enumerable.Empty()) + { + } + public DbProviderFactoryCreator( Func getFactory, IEnumerable syntaxProviders, diff --git a/src/Umbraco.Infrastructure/Persistence/IDbProviderFactoryCreator.cs b/src/Umbraco.Infrastructure/Persistence/IDbProviderFactoryCreator.cs index f9bdf00f8f..4ee6ce7d59 100644 --- a/src/Umbraco.Infrastructure/Persistence/IDbProviderFactoryCreator.cs +++ b/src/Umbraco.Infrastructure/Persistence/IDbProviderFactoryCreator.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Data.Common; +using System.Linq; using Umbraco.Cms.Infrastructure.Persistence.SqlSyntax; namespace Umbraco.Cms.Infrastructure.Persistence @@ -12,6 +13,8 @@ namespace Umbraco.Cms.Infrastructure.Persistence IBulkSqlInsertProvider CreateBulkSqlInsertProvider(string providerName); void CreateDatabase(string providerName, string connectionString); NPocoMapperCollection ProviderSpecificMappers(string providerName); - IEnumerable GetProviderSpecificInterceptors(string providerName); + + IEnumerable GetProviderSpecificInterceptors(string providerName) => + Enumerable.Empty(); } } diff --git a/src/Umbraco.Infrastructure/Persistence/IUmbracoDatabaseFactory.cs b/src/Umbraco.Infrastructure/Persistence/IUmbracoDatabaseFactory.cs index 37f4307ab7..a4d4259cbe 100644 --- a/src/Umbraco.Infrastructure/Persistence/IUmbracoDatabaseFactory.cs +++ b/src/Umbraco.Infrastructure/Persistence/IUmbracoDatabaseFactory.cs @@ -1,4 +1,4 @@ -using System; +using System; using Umbraco.Cms.Core.Configuration.Models; namespace Umbraco.Cms.Infrastructure.Persistence @@ -54,6 +54,10 @@ namespace Umbraco.Cms.Infrastructure.Persistence /// void Configure(ConnectionStrings umbracoConnectionString); + [Obsolete("Please use alternative Configure method.")] + void Configure(string connectionString, string providerName) => + Configure(new ConnectionStrings { ConnectionString = connectionString, ProviderName = providerName }); + /// /// Gets the . /// diff --git a/src/Umbraco.Infrastructure/Persistence/SqlSyntax/ISqlSyntaxProvider.cs b/src/Umbraco.Infrastructure/Persistence/SqlSyntax/ISqlSyntaxProvider.cs index aeb0f51c4c..7760f86476 100644 --- a/src/Umbraco.Infrastructure/Persistence/SqlSyntax/ISqlSyntaxProvider.cs +++ b/src/Umbraco.Infrastructure/Persistence/SqlSyntax/ISqlSyntaxProvider.cs @@ -16,7 +16,8 @@ namespace Umbraco.Cms.Infrastructure.Persistence.SqlSyntax /// public interface ISqlSyntaxProvider { - DatabaseType GetUpdatedDatabaseType(DatabaseType current, string? connectionString); + DatabaseType GetUpdatedDatabaseType(DatabaseType current, string? connectionString) => + current; // Default implementation. string ProviderName { get; } @@ -160,6 +161,6 @@ namespace Umbraco.Cms.Infrastructure.Persistence.SqlSyntax Func, Sql> nestedJoin, string? alias = null); - IDictionary? ScalarMappers { get; } + IDictionary? ScalarMappers => null; } } diff --git a/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotServiceEventHandler.cs b/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotServiceEventHandler.cs index e2f8f57bbe..d3ad80a960 100644 --- a/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotServiceEventHandler.cs +++ b/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotServiceEventHandler.cs @@ -4,6 +4,7 @@ using Umbraco.Cms.Core.Events; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Notifications; using Umbraco.Cms.Core.PublishedCache; +using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Services.Changes; using Umbraco.Cms.Infrastructure.PublishedCache.Persistence; using Umbraco.Extensions; @@ -38,6 +39,17 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache _publishedContentService = publishedContentService; } + [Obsolete("Please use alternative constructor.")] + public PublishedSnapshotServiceEventHandler( + IRuntimeState runtime, + IPublishedSnapshotService publishedSnapshotService, + INuCacheContentService publishedContentService, + IContentService contentService, + IMediaService mediaService) + : this(publishedSnapshotService, publishedContentService) + { + } + // note: if the service is not ready, ie _isReady is false, then we still handle repository events, // because we can, we do not need a working published snapshot to do it - the only reason why it could cause an // issue is if the database table is not ready, but that should be prevented by migrations.