Kill UmbracoContext.Current

This commit is contained in:
Stephan
2019-02-14 09:49:45 +01:00
parent 969c2aa184
commit abceda7750
35 changed files with 121 additions and 110 deletions

View File

@@ -4,6 +4,7 @@ using HeyRed.MarkdownSharp;
using Umbraco.Core;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Composing;
using Umbraco.Web.Templates;
namespace Umbraco.Web.PropertyEditors.ValueConverters
@@ -26,7 +27,7 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
var sourceString = source.ToString();
// ensures string is parsed for {localLink} and urls are resolved correctly
sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview, UmbracoContext.Current);
sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview, Current.UmbracoContext);
sourceString = TemplateUtilities.ResolveUrlsFromTextString(sourceString);
return sourceString;

View File

@@ -2,6 +2,7 @@
using Umbraco.Core;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Composing;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.Security;
@@ -44,7 +45,7 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
if (source == null)
return null;
if (UmbracoContext.Current != null)
if (Current.UmbracoContext != null)
{
IPublishedContent member;
if (source is int id)

View File

@@ -9,6 +9,7 @@ using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.ValueConverters;
using Umbraco.Core.Services;
using Umbraco.Web.Composing;
using Umbraco.Web.PublishedCache;
namespace Umbraco.Web.PropertyEditors.ValueConverters
@@ -67,7 +68,7 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
}
// TODO: Inject an UmbracoHelper and create a GetUmbracoHelper method based on either injected or singleton
if (UmbracoContext.Current != null)
if (Current.UmbracoContext != null)
{
if (propertyType.EditorAlias.Equals(Constants.PropertyEditors.Aliases.MultiNodeTreePicker))
{

View File

@@ -9,6 +9,7 @@ using System.Linq;
using HtmlAgilityPack;
using Umbraco.Core.Cache;
using Umbraco.Core.Services;
using Umbraco.Web.Composing;
using Umbraco.Web.Macros;
namespace Umbraco.Web.PropertyEditors.ValueConverters
@@ -72,7 +73,7 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
var sourceString = source.ToString();
// ensures string is parsed for {localLink} and urls are resolved correctly
sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview, UmbracoContext.Current);
sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview, Current.UmbracoContext);
sourceString = TemplateUtilities.ResolveUrlsFromTextString(sourceString);
// ensure string is parsed for macros and macros are executed correctly

View File

@@ -3,6 +3,7 @@ using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Composing;
using Umbraco.Web.Templates;
namespace Umbraco.Web.PropertyEditors.ValueConverters
@@ -31,7 +32,7 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
var sourceString = source.ToString();
// ensures string is parsed for {localLink} and urls are resolved correctly
sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview, UmbracoContext.Current);
sourceString = TemplateUtilities.ParseInternalLinks(sourceString, preview, Current.UmbracoContext);
sourceString = TemplateUtilities.ResolveUrlsFromTextString(sourceString);
return sourceString;