From 576bc1f60b7f03191b088e27fabe5a5e55652c94 Mon Sep 17 00:00:00 2001 From: Matthew Care Date: Mon, 25 Oct 2021 14:30:58 +0100 Subject: [PATCH] Make requested changes Prevent breaking change by creating a new ctor Update obsolete message --- src/Umbraco.Core/IO/ViewHelper.cs | 2 +- .../Controllers/TemplateController.cs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/IO/ViewHelper.cs b/src/Umbraco.Core/IO/ViewHelper.cs index 80ff48a94343..16c880b3c1c1 100644 --- a/src/Umbraco.Core/IO/ViewHelper.cs +++ b/src/Umbraco.Core/IO/ViewHelper.cs @@ -12,7 +12,7 @@ public class ViewHelper : IViewHelper private readonly IFileSystem _viewFileSystem; private readonly IDefaultViewContentProvider _defaultViewContentProvider; - [Obsolete("Inject IViewHelper instead")] + [Obsolete("Use ctor with all params")] public ViewHelper(IFileSystem viewFileSystem) => _viewFileSystem = viewFileSystem ?? throw new ArgumentNullException(nameof(viewFileSystem)); public ViewHelper(FileSystems fileSystems, IDefaultViewContentProvider defaultViewContentProvider) diff --git a/src/Umbraco.Web.BackOffice/Controllers/TemplateController.cs b/src/Umbraco.Web.BackOffice/Controllers/TemplateController.cs index 46a770428e8d..8cef90cb575a 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/TemplateController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/TemplateController.cs @@ -3,6 +3,7 @@ using System.Linq; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Core; using Umbraco.Cms.Core.IO; using Umbraco.Cms.Core.Mapping; @@ -12,6 +13,7 @@ using Umbraco.Cms.Core.Strings; using Umbraco.Cms.Web.Common.Attributes; using Umbraco.Cms.Web.Common.Authorization; +using Umbraco.Cms.Web.Common.DependencyInjection; using Constants = Umbraco.Cms.Core.Constants; namespace Umbraco.Cms.Web.BackOffice.Controllers @@ -38,6 +40,15 @@ public TemplateController( _defaultViewContentProvider = defaultViewContentProvider ?? throw new ArgumentNullException(nameof(defaultViewContentProvider)); } + [Obsolete("Use ctor will all params")] + public TemplateController( + IFileService fileService, + IUmbracoMapper umbracoMapper, + IShortStringHelper shortStringHelper) + : this(fileService, umbracoMapper, shortStringHelper, StaticServiceProvider.Instance.GetRequiredService()) + { + } + /// /// Gets data type by alias ///