From 19a9caf47ba6cc6a7c325c5e56da850c013919b7 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Thu, 15 Apr 2021 12:49:47 +0200 Subject: [PATCH] Removed project configuration to expose internals to Forms and made the two used internal dependencies public. --- src/Umbraco.Core/Umbraco.Core.csproj | 14 -------------- .../Persistence/Mappers/MapperForAttribute.cs | 9 +++------ .../Umbraco.Infrastructure.csproj | 14 -------------- .../Filters/FileUploadCleanupFilterAttribute.cs | 15 ++++++--------- .../Umbraco.Web.BackOffice.csproj | 8 -------- src/Umbraco.Web.Common/Umbraco.Web.Common.csproj | 8 -------- .../Umbraco.Web.Website.csproj | 8 -------- 7 files changed, 9 insertions(+), 67 deletions(-) diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 28c60c91b7..27e3098a31 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -46,20 +46,6 @@ <_Parameter1>DynamicProxyGenAssembly2 - - - diff --git a/src/Umbraco.Infrastructure/Persistence/Mappers/MapperForAttribute.cs b/src/Umbraco.Infrastructure/Persistence/Mappers/MapperForAttribute.cs index 5cdf4dfc63..c2caa89bd9 100644 --- a/src/Umbraco.Infrastructure/Persistence/Mappers/MapperForAttribute.cs +++ b/src/Umbraco.Infrastructure/Persistence/Mappers/MapperForAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Umbraco.Cms.Infrastructure.Persistence.Mappers { @@ -6,14 +6,11 @@ namespace Umbraco.Cms.Infrastructure.Persistence.Mappers /// An attribute used to decorate mappers to be associated with entities /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] - internal sealed class MapperForAttribute : Attribute + public sealed class MapperForAttribute : Attribute { public Type EntityType { get; private set; } - public MapperForAttribute(Type entityType) - { - EntityType = entityType; - } + public MapperForAttribute(Type entityType) => EntityType = entityType; } } diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index 7ecc71bb8f..90554b3401 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -101,20 +101,6 @@ <_Parameter1>DynamicProxyGenAssembly2 - - - diff --git a/src/Umbraco.Web.BackOffice/Filters/FileUploadCleanupFilterAttribute.cs b/src/Umbraco.Web.BackOffice/Filters/FileUploadCleanupFilterAttribute.cs index 49085de977..32fa5eeabd 100644 --- a/src/Umbraco.Web.BackOffice/Filters/FileUploadCleanupFilterAttribute.cs +++ b/src/Umbraco.Web.BackOffice/Filters/FileUploadCleanupFilterAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.Logging; using Umbraco.Cms.Core.Models.ContentEditing; +using Umbraco.Cms.Core.Models.Editors; using Umbraco.Extensions; namespace Umbraco.Cms.Web.BackOffice.Filters @@ -15,20 +16,17 @@ namespace Umbraco.Cms.Web.BackOffice.Filters /// Checks if the parameter is IHaveUploadedFiles and then deletes any temporary saved files from file uploads /// associated with the request /// - internal sealed class FileUploadCleanupFilterAttribute : TypeFilterAttribute + public sealed class FileUploadCleanupFilterAttribute : TypeFilterAttribute { /// /// Constructor specifies if the filter should analyze the incoming or outgoing model /// /// - public FileUploadCleanupFilterAttribute( bool incomingModel = true) : base(typeof(FileUploadCleanupFilter)) - { - + public FileUploadCleanupFilterAttribute(bool incomingModel = true) : base(typeof(FileUploadCleanupFilter)) => Arguments = new object[] { incomingModel }; - } // We need to use IAsyncActionFilter even that we dont have any async because we need access to // context.ActionArguments, and this is only available on ActionExecutingContext and not on @@ -45,7 +43,6 @@ namespace Umbraco.Cms.Web.BackOffice.Filters _incomingModel = incomingModel; } - public Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { next(); // We only to do stuff after the action is executed @@ -60,7 +57,7 @@ namespace Umbraco.Cms.Web.BackOffice.Filters if (context.ActionArguments.First().Value is IHaveUploadedFiles contentItem) { //cleanup any files associated - foreach (var f in contentItem.UploadedFiles) + foreach (ContentPropertyFile f in contentItem.UploadedFiles) { //track all temp folders so we can remove old files afterwards var dir = Path.GetDirectoryName(f.TempFilePath); @@ -109,7 +106,7 @@ namespace Umbraco.Cms.Web.BackOffice.Filters if (uploadedFiles.UploadedFiles != null) { //cleanup any files associated - foreach (var f in uploadedFiles.UploadedFiles) + foreach (ContentPropertyFile f in uploadedFiles.UploadedFiles) { if (f.TempFilePath.IsNullOrWhiteSpace() == false) { diff --git a/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj b/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj index b71d6e1c9d..01dffccaeb 100644 --- a/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj +++ b/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj @@ -31,14 +31,6 @@ <_Parameter1>Umbraco.Tests.Integration - - - diff --git a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj index 70bd96c2cc..bb2ecbc346 100644 --- a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj +++ b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj @@ -40,14 +40,6 @@ <_Parameter1>Umbraco.Tests.UnitTests - - - diff --git a/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj b/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj index 142a389f07..7ebf12e6d9 100644 --- a/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj +++ b/src/Umbraco.Web.Website/Umbraco.Web.Website.csproj @@ -34,13 +34,5 @@ <_Parameter1>Umbraco.Tests.Integration - - -