Merge pull request #7380 from AndyButland/feature/7371-short-string-helper

.NET Core transition: Removed (almost) all instances of Current.ShortStringHlper and replaced with constructor injection (#7371)
This commit is contained in:
Bjarke Berg
2020-01-07 09:05:28 +01:00
committed by GitHub
92 changed files with 454 additions and 432 deletions

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -32,7 +31,6 @@ using File = System.IO.File;
namespace Umbraco.Web.PublishedCache.NuCache
{
internal class PublishedSnapshotService : PublishedSnapshotServiceBase
{
private readonly ServiceContext _serviceContext;
@@ -50,6 +48,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
private readonly UrlSegmentProviderCollection _urlSegmentProviders;
private readonly ITypeFinder _typeFinder;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IShortStringHelper _shortStringHelper;
// volatile because we read it with no lock
private volatile bool _isReady;
@@ -84,7 +83,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
IPublishedModelFactory publishedModelFactory,
UrlSegmentProviderCollection urlSegmentProviders,
ITypeFinder typeFinder,
IHostingEnvironment hostingEnvironment)
IHostingEnvironment hostingEnvironment,
IShortStringHelper shortStringHelper)
: base(publishedSnapshotAccessor, variationContextAccessor)
{
//if (Interlocked.Increment(ref _singletonCheck) > 1)
@@ -103,6 +103,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
_urlSegmentProviders = urlSegmentProviders;
_typeFinder = typeFinder;
_hostingEnvironment = hostingEnvironment;
_shortStringHelper = shortStringHelper;
// we need an Xml serializer here so that the member cache can support XPath,
// for members this is done by navigating the serialized-to-xml member
@@ -1406,7 +1407,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
cultureData[cultureInfo.Culture] = new CultureVariation
{
Name = cultureInfo.Name,
UrlSegment = content.GetUrlSegment(Current.ShortStringHelper, _urlSegmentProviders, cultureInfo.Culture),
UrlSegment = content.GetUrlSegment(_shortStringHelper, _urlSegmentProviders, cultureInfo.Culture),
Date = content.GetUpdateDate(cultureInfo.Culture) ?? DateTime.MinValue,
IsDraft = cultureIsDraft
};
@@ -1418,7 +1419,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
{
PropertyData = propertyData,
CultureData = cultureData,
UrlSegment = content.GetUrlSegment(Current.ShortStringHelper, _urlSegmentProviders)
UrlSegment = content.GetUrlSegment(_shortStringHelper, _urlSegmentProviders)
};
var dto = new ContentNuDto