From ed3e693308595dcde9ad1031e1df01656fd8a678 Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 13 Apr 2018 11:02:16 +0200 Subject: [PATCH] Umbraco.Compat7.die.die.die --- build/NuSpecs/UmbracoCms.Compat7.nuspec | 27 --- build/NuSpecs/UmbracoCms.Core.nuspec | 6 +- build/NuSpecs/UmbracoCms.nuspec | 3 +- build/build.ps1 | 33 +-- src/Umbraco.Compat7/Compat7Component.cs | 70 ------ src/Umbraco.Compat7/Core/ActionsResolver.cs | 17 -- .../Core/ApplicationContext.cs | 37 --- .../Core/ApplicationEventHandler.cs | 63 ----- .../Core/Cache/CacheRefreshersResolver.cs | 23 -- src/Umbraco.Compat7/Core/DatabaseContext.cs | 65 ----- .../CultureDictionaryFactoryResolver.cs | 24 -- .../Core/IApplicationEventHandler.cs | 34 --- src/Umbraco.Compat7/Core/Logging/LogHelper.cs | 222 ------------------ .../Core/Logging/LoggerResolver.cs | 25 -- .../Core/Logging/ProfilerResolver.cs | 25 -- .../PublishedContentModelFactoryResolver.cs | 23 -- .../LazyManyObjectsResolverBase.cs | 57 ----- .../ManyObjectsResolverBase.cs | 103 -------- .../WeightedObjectsResolverBase.cs | 103 -------- .../PropertyEditors/PropertyEditorResolver.cs | 22 -- .../PropertyValueConvertersResolver.cs | 20 -- .../Core/Strings/ShortStringHelperResolver.cs | 24 -- .../Strings/UrlSegmentProviderResolver.cs | 20 -- .../Core/Sync/ServerMessengerResolver.cs | 24 -- .../Core/Sync/ServerRegistrarResolver.cs | 24 -- .../Properties/AssemblyInfo.cs | 10 - src/Umbraco.Compat7/Umbraco.Compat7.csproj | 110 --------- .../Web/HealthCheck/HealthCheckResolver.cs | 20 -- .../Web/Media/ThumbnailProvidersResolver.cs | 24 -- .../Web/Models/IRenderModel.cs | 10 - src/Umbraco.Compat7/Web/Models/RenderModel.cs | 39 --- .../Web/Models/RenderModelOfTContent.cs | 24 -- .../Mvc/DefaultRenderMvcControllerResolver.cs | 24 -- .../FilteredControllerFactoriesResolver.cs | 21 -- .../Web/Mvc/UmbracoTemplatePage.cs | 29 --- .../Web/Mvc/UmbracoTemplatePageOfTContent.cs | 28 --- .../PublishedSnapshotServiceResolver.cs | 15 -- .../Web/Routing/ContentFinderResolver.cs | 21 -- .../ContentLastChangeFinderResolver.cs | 40 ---- .../Web/Routing/SiteDomainHelperResolver.cs | 25 -- .../Web/Routing/UrlProviderResolver.cs | 21 -- .../Web/UmbracoHelperExtensions.cs | 13 - src/Umbraco.Compat7/notes.txt | 41 ---- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 5 +- src/umbraco.sln | 11 - 45 files changed, 10 insertions(+), 1615 deletions(-) delete mode 100644 build/NuSpecs/UmbracoCms.Compat7.nuspec delete mode 100644 src/Umbraco.Compat7/Compat7Component.cs delete mode 100644 src/Umbraco.Compat7/Core/ActionsResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/ApplicationContext.cs delete mode 100644 src/Umbraco.Compat7/Core/ApplicationEventHandler.cs delete mode 100644 src/Umbraco.Compat7/Core/Cache/CacheRefreshersResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/DatabaseContext.cs delete mode 100644 src/Umbraco.Compat7/Core/Dictionary/CultureDictionaryFactoryResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/IApplicationEventHandler.cs delete mode 100644 src/Umbraco.Compat7/Core/Logging/LogHelper.cs delete mode 100644 src/Umbraco.Compat7/Core/Logging/LoggerResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/Logging/ProfilerResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/Models/PublishedContent/PublishedContentModelFactoryResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/ObjectResolution/LazyManyObjectsResolverBase.cs delete mode 100644 src/Umbraco.Compat7/Core/ObjectResolution/ManyObjectsResolverBase.cs delete mode 100644 src/Umbraco.Compat7/Core/ObjectResolution/WeightedObjectsResolverBase.cs delete mode 100644 src/Umbraco.Compat7/Core/PropertyEditors/PropertyEditorResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/PropertyEditors/PropertyValueConvertersResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/Strings/ShortStringHelperResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/Strings/UrlSegmentProviderResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/Sync/ServerMessengerResolver.cs delete mode 100644 src/Umbraco.Compat7/Core/Sync/ServerRegistrarResolver.cs delete mode 100644 src/Umbraco.Compat7/Properties/AssemblyInfo.cs delete mode 100644 src/Umbraco.Compat7/Umbraco.Compat7.csproj delete mode 100644 src/Umbraco.Compat7/Web/HealthCheck/HealthCheckResolver.cs delete mode 100644 src/Umbraco.Compat7/Web/Media/ThumbnailProvidersResolver.cs delete mode 100644 src/Umbraco.Compat7/Web/Models/IRenderModel.cs delete mode 100644 src/Umbraco.Compat7/Web/Models/RenderModel.cs delete mode 100644 src/Umbraco.Compat7/Web/Models/RenderModelOfTContent.cs delete mode 100644 src/Umbraco.Compat7/Web/Mvc/DefaultRenderMvcControllerResolver.cs delete mode 100644 src/Umbraco.Compat7/Web/Mvc/FilteredControllerFactoriesResolver.cs delete mode 100644 src/Umbraco.Compat7/Web/Mvc/UmbracoTemplatePage.cs delete mode 100644 src/Umbraco.Compat7/Web/Mvc/UmbracoTemplatePageOfTContent.cs delete mode 100644 src/Umbraco.Compat7/Web/PublishedCache/PublishedSnapshotServiceResolver.cs delete mode 100644 src/Umbraco.Compat7/Web/Routing/ContentFinderResolver.cs delete mode 100644 src/Umbraco.Compat7/Web/Routing/ContentLastChangeFinderResolver.cs delete mode 100644 src/Umbraco.Compat7/Web/Routing/SiteDomainHelperResolver.cs delete mode 100644 src/Umbraco.Compat7/Web/Routing/UrlProviderResolver.cs delete mode 100644 src/Umbraco.Compat7/Web/UmbracoHelperExtensions.cs delete mode 100644 src/Umbraco.Compat7/notes.txt diff --git a/build/NuSpecs/UmbracoCms.Compat7.nuspec b/build/NuSpecs/UmbracoCms.Compat7.nuspec deleted file mode 100644 index d2719a694e..0000000000 --- a/build/NuSpecs/UmbracoCms.Compat7.nuspec +++ /dev/null @@ -1,27 +0,0 @@ - - - - UmbracoCms.Compat7 - 8.0.0 - Umbraco Cms Compat7 - Umbraco HQ - Umbraco HQ - http://opensource.org/licenses/MIT - http://umbraco.com/ - http://umbraco.com/media/357769/100px_transparent.png - false - Contains resources aiming at providing a better v7-to-v8 backward compatibility. - Umbraco v7 compatibility layer for v8. - en-US - umbraco - - - - - - - - - \ No newline at end of file diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index 64c8b89f49..ad690227b1 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -21,7 +21,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -41,6 +41,8 @@ + + diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec index 8f5cf495c7..241a46d2c2 100644 --- a/build/NuSpecs/UmbracoCms.nuspec +++ b/build/NuSpecs/UmbracoCms.nuspec @@ -16,8 +16,7 @@ umbraco - - + diff --git a/build/build.ps1 b/build/build.ps1 index c23b492be7..0db043cafe 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -153,7 +153,6 @@ $src = "$($this.SolutionRoot)\src" $log = "$($this.BuildTemp)\msbuild.umbraco.log" - $log7 = "$($this.BuildTemp)\msbuild.compat7.log" if ($this.BuildEnv.VisualStudio -eq $null) { @@ -181,24 +180,6 @@ if (-not $?) { throw "Failed to compile Umbraco.Web.UI." } - Write-Host "Logging to $log7" - - &$this.BuildEnv.VisualStudio.MsBuild "$src\Umbraco.Compat7\Umbraco.Compat7.csproj" ` - /p:WarningLevel=0 ` - /p:Configuration=$buildConfiguration ` - /p:Platform=AnyCPU ` - /p:UseWPP_CopyWebApplication=True ` - /p:PipelineDependsOnBuild=False ` - /p:OutDir="$($this.BuildTemp)\bin\\" ` - /p:WebProjectOutputDir="$($this.BuildTemp)\WebApp\\" ` - /p:Verbosity=minimal ` - /t:Rebuild ` - /tv:"$($this.BuildEnv.VisualStudio.ToolsVersion)" ` - /p:UmbracoBuild=True ` - > $log7 - - if (-not $?) { throw "Failed to compile Umbraco.Compat7." } - # /p:UmbracoBuild tells the csproj that we are building from PS, not VS }) @@ -342,14 +323,14 @@ Write-Host "Zip all binaries" &$this.BuildEnv.Zip a -r "$out\UmbracoCms.AllBinaries.$($this.Version.Semver).zip" ` "$tmp\bin\*" ` - "-x!dotless.Core.*" "-x!Umbraco.Compat7.*" ` + "-x!dotless.Core.*" ` > $null if (-not $?) { throw "Failed to zip UmbracoCms.AllBinaries." } Write-Host "Zip cms" &$this.BuildEnv.Zip a -r "$out\UmbracoCms.$($this.Version.Semver).zip" ` "$tmp\WebApp\*" ` - "-x!dotless.Core.*" "-x!Content_Types.xml" "-x!*.pdb" "-x!Umbraco.Compat7.*" ` + "-x!dotless.Core.*" "-x!Content_Types.xml" "-x!*.pdb" ` > $null if (-not $?) { throw "Failed to zip UmbracoCms." } }) @@ -427,12 +408,6 @@ -Verbosity detailed -outputDirectory "$($this.BuildOutput)" > "$($this.BuildTemp)\nupack.cms.log" if (-not $?) { throw "Failed to pack NuGet UmbracoCms." } - &$this.BuildEnv.NuGet Pack "$nuspecs\UmbracoCms.Compat7.nuspec" ` - -Properties BuildTmp="$($this.BuildTemp)" ` - -Version $this.Version.Semver.ToString() ` - -Verbosity detailed -outputDirectory "$($this.BuildOutput)" > "$($this.BuildTemp)\nupack.compat7.log" - if (-not $?) { throw "Failed to pack NuGet UmbracoCms.Compat7." } - # run hook if ($this.HasMethod("PostPackageNuGet")) { @@ -445,8 +420,8 @@ $ubuild.DefineMethod("VerifyNuGet", { $this.VerifyNuGetConsistency( - ("UmbracoCms", "UmbracoCms.Core", "UmbracoCms.Compat7"), - ("Umbraco.Core", "Umbraco.Web", "Umbraco.Web.UI", "Umbraco.Examine", "Umbraco.Compat7")) + ("UmbracoCms", "UmbracoCms.Core"), + ("Umbraco.Core", "Umbraco.Web", "Umbraco.Web.UI", "Umbraco.Examine")) if ($this.OnError()) { return } }) diff --git a/src/Umbraco.Compat7/Compat7Component.cs b/src/Umbraco.Compat7/Compat7Component.cs deleted file mode 100644 index 6fe60ad31b..0000000000 --- a/src/Umbraco.Compat7/Compat7Component.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using LightInject; -using System.Linq; -using Umbraco.Core; -using Umbraco.Core.Components; -using Umbraco.Core.Logging; -using Umbraco.Core.Composing; - -namespace Umbraco.Compat7 -{ - public class Compat7Component : UmbracoComponentBase, IUmbracoUserComponent - { - private List _handlers; - private UmbracoApplicationBase _app; - - // these events replace the UmbracoApplicationBase corresponding events - public static event EventHandler ApplicationStarting; - public static event EventHandler ApplicationStarted; - - public override void Compose(Composition composition) - { - base.Compose(composition); - - var container = composition.Container; - _app = container.GetInstance(); - var logger = container.GetInstance(); - - var pluginManager = container.GetInstance(); - var handlerTypes = pluginManager.GetTypes(); - - _handlers = handlerTypes.Select(Activator.CreateInstance).Cast().ToList(); - - foreach (var handler in _handlers) - logger.Debug($"Adding ApplicationEventHandler {handler.GetType().FullName}."); - - foreach (var handler in _handlers) - handler.OnApplicationInitialized(_app, ApplicationContext.Current); - - foreach (var handler in _handlers) - handler.OnApplicationStarting(_app, ApplicationContext.Current); - - try - { - ApplicationStarting?.Invoke(_app, EventArgs.Empty); - } - catch (Exception ex) - { - logger.Error("An error occurred in an ApplicationStarting event handler", ex); - throw; - } - } - - public void Initialize(ILogger logger) - { - foreach (var handler in _handlers) - handler.OnApplicationStarted(_app, ApplicationContext.Current); - - try - { - ApplicationStarted?.Invoke(_app, EventArgs.Empty); - } - catch (Exception ex) - { - logger.Error("An error occurred in an ApplicationStarting event handler", ex); - throw; - } - } - } -} diff --git a/src/Umbraco.Compat7/Core/ActionsResolver.cs b/src/Umbraco.Compat7/Core/ActionsResolver.cs deleted file mode 100644 index 3ee2a26ee0..0000000000 --- a/src/Umbraco.Compat7/Core/ActionsResolver.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Web._Legacy.Actions; -using WebCurrent = Umbraco.Web.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core -{ - public class ActionsResolver - { - private ActionsResolver() - { } - - public static ActionsResolver Current { get; } = new ActionsResolver(); - - public IEnumerable Actions => WebCurrent.Actions; - } -} diff --git a/src/Umbraco.Compat7/Core/ApplicationContext.cs b/src/Umbraco.Compat7/Core/ApplicationContext.cs deleted file mode 100644 index 136ab42138..0000000000 --- a/src/Umbraco.Compat7/Core/ApplicationContext.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using Umbraco.Core.Cache; -using Umbraco.Core.Logging; -using Umbraco.Core.Persistence; -using Umbraco.Core.Services; -using LightInject; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core -{ - public class ApplicationContext : IDisposable - { - private ApplicationContext() - { - DatabaseContext = new DatabaseContext(Composing.Current.Container.GetInstance()); - } - - public static ApplicationContext Current { get; } = new ApplicationContext(); - - public CacheHelper ApplicationCache => Composing.Current.ApplicationCache; - - public ProfilingLogger ProfilingLogger => Composing.Current.ProfilingLogger; - - public bool IsReady { get; } = true; // because... not accessible before we are ready - - public bool IsConfigured => Composing.Current.RuntimeState.Level == RuntimeLevel.Run; - - public bool IsUpgrading => Composing.Current.RuntimeState.Level == RuntimeLevel.Upgrade; - - public DatabaseContext DatabaseContext { get; } - - public ServiceContext Services => Composing.Current.Services; - - public void Dispose() - { } - } -} diff --git a/src/Umbraco.Compat7/Core/ApplicationEventHandler.cs b/src/Umbraco.Compat7/Core/ApplicationEventHandler.cs deleted file mode 100644 index b60c5dd49f..0000000000 --- a/src/Umbraco.Compat7/Core/ApplicationEventHandler.cs +++ /dev/null @@ -1,63 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace Umbraco.Core -{ - public abstract class ApplicationEventHandler : IApplicationEventHandler - { - public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) - { - if (ShouldExecute(applicationContext)) - { - ApplicationInitialized(umbracoApplication, applicationContext); - } - } - - public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) - { - if (ShouldExecute(applicationContext)) - { - ApplicationStarting(umbracoApplication, applicationContext); - } - } - - public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) - { - if (ShouldExecute(applicationContext)) - { - ApplicationStarted(umbracoApplication, applicationContext); - } - } - - protected virtual void ApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) - { } - - protected virtual void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) - { } - - protected virtual void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) - { } - - private bool ShouldExecute(ApplicationContext applicationContext) - { - if (applicationContext.IsConfigured && applicationContext.DatabaseContext.IsDatabaseConfigured) - { - return true; - } - - if (applicationContext.IsConfigured == false && ExecuteWhenApplicationNotConfigured) - { - return true; - } - - if (applicationContext.DatabaseContext.IsDatabaseConfigured == false && ExecuteWhenDatabaseNotConfigured) - { - return true; - } - - return false; - } - - protected virtual bool ExecuteWhenApplicationNotConfigured => false; - - protected virtual bool ExecuteWhenDatabaseNotConfigured => false; - } -} diff --git a/src/Umbraco.Compat7/Core/Cache/CacheRefreshersResolver.cs b/src/Umbraco.Compat7/Core/Cache/CacheRefreshersResolver.cs deleted file mode 100644 index 849e9ad483..0000000000 --- a/src/Umbraco.Compat7/Core/Cache/CacheRefreshersResolver.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.Composing.Current; -using LightInject; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.Cache -{ - public class CacheRefreshersResolver : LazyManyObjectsResolverBase - { - private CacheRefreshersResolver(CacheRefresherCollectionBuilder builder) - : base(builder) - { } - - public static CacheRefreshersResolver Current { get; } - = new CacheRefreshersResolver(CoreCurrent.Container.GetInstance()); - - public IEnumerable CacheRefreshers => CoreCurrent.CacheRefreshers; - - public ICacheRefresher GetById(Guid id) => CoreCurrent.CacheRefreshers[id]; - } -} diff --git a/src/Umbraco.Compat7/Core/DatabaseContext.cs b/src/Umbraco.Compat7/Core/DatabaseContext.cs deleted file mode 100644 index 35a5829a56..0000000000 --- a/src/Umbraco.Compat7/Core/DatabaseContext.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using NPoco; -using Umbraco.Core.Persistence; -using Umbraco.Core.Persistence.Querying; -using Umbraco.Core.Persistence.SqlSyntax; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core -{ - public class DatabaseContext - { - private readonly IUmbracoDatabaseFactory _databaseFactory; - - /// - /// Initializes a new instance of the class. - /// - /// A database factory. - /// The database factory will try to configure itself but may fail eg if the default - /// Umbraco connection string is not available because we are installing. In which case this - /// database builder must sort things out and configure the database factory before it can be - /// used. - public DatabaseContext(IUmbracoDatabaseFactory databaseFactory) - { - _databaseFactory = databaseFactory ?? throw new ArgumentNullException(nameof(databaseFactory)); - } - - /// - /// Gets the database Sql syntax. - /// - public ISqlSyntaxProvider SqlSyntax => _databaseFactory.SqlContext.SqlSyntax; - - /// - /// Creates a Sql statement. - /// - public Sql Sql() => _databaseFactory.SqlContext.Sql(); - - /// - /// Creates a Sql statement. - /// - public Sql Sql(string sql, params object[] args) => _databaseFactory.SqlContext.Sql(sql, args); - - /// - /// Creates a Query expression. - /// - public IQuery Query() => _databaseFactory.SqlContext.Query(); - - /// - /// Gets an ambient database for doing CRUD operations against custom tables that resides in the Umbraco database. - /// - /// Should not be used for operation against standard Umbraco tables; as services should be used instead. - public IUmbracoDatabase Database => throw new NotImplementedException(); // there's no magic? - - /// - /// Gets a value indicating whether the database is configured. - /// - /// It does not necessarily mean that it is possible to - /// connect, nor that Umbraco is installed, nor up-to-date. - public bool IsDatabaseConfigured => _databaseFactory.Configured; - - /// - /// Gets a value indicating whether it is possible to connect to the database. - /// - public bool CanConnect => _databaseFactory.Configured && _databaseFactory.CanConnect; - } -} diff --git a/src/Umbraco.Compat7/Core/Dictionary/CultureDictionaryFactoryResolver.cs b/src/Umbraco.Compat7/Core/Dictionary/CultureDictionaryFactoryResolver.cs deleted file mode 100644 index 10bab2f875..0000000000 --- a/src/Umbraco.Compat7/Core/Dictionary/CultureDictionaryFactoryResolver.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Umbraco.Core.Composing; -using CoreCurrent = Umbraco.Core.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.Dictionary -{ - public class CultureDictionaryFactoryResolver - { - private CultureDictionaryFactoryResolver() - { } - - public static bool HasCurrent => true; - - public static CultureDictionaryFactoryResolver Current { get; } - = new CultureDictionaryFactoryResolver(); - - public ICultureDictionaryFactory Factory => CoreCurrent.CultureDictionaryFactory; - - public void SetDictionaryFactory(ICultureDictionaryFactory factory) - { - CoreCurrent.Container.RegisterSingleton(_ => factory); - } - } -} diff --git a/src/Umbraco.Compat7/Core/IApplicationEventHandler.cs b/src/Umbraco.Compat7/Core/IApplicationEventHandler.cs deleted file mode 100644 index 098e66e1aa..0000000000 --- a/src/Umbraco.Compat7/Core/IApplicationEventHandler.cs +++ /dev/null @@ -1,34 +0,0 @@ -// ReSharper disable once CheckNamespace - -using Umbraco.Core.Composing; - -namespace Umbraco.Core -{ - /// - /// Custom IApplicationStartupHandler that auto subscribes to the applications events - /// - public interface IApplicationEventHandler : IDiscoverable - { - /// - /// ApplicationContext is created and other static objects that require initialization have been setup - /// - /// - /// - void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext); - - /// - /// All resolvers have been initialized but resolution is not frozen so they can be modified in this method - /// - /// - /// - void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext); - - /// - /// Bootup is completed, this allows you to perform any other bootup logic required for the application. - /// Resolution is frozen so now they can be used to resolve instances. - /// - /// - /// - void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext); - } -} diff --git a/src/Umbraco.Compat7/Core/Logging/LogHelper.cs b/src/Umbraco.Compat7/Core/Logging/LogHelper.cs deleted file mode 100644 index 060c2b9c53..0000000000 --- a/src/Umbraco.Compat7/Core/Logging/LogHelper.cs +++ /dev/null @@ -1,222 +0,0 @@ -using System; -using System.Linq; -using System.Web; -using Umbraco.Core.Composing; -using Umbraco.Core.Exceptions; -using Umbraco.Web; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.Logging -{ - public static class LogHelper - { - #region Error - /// - /// Adds an error log - /// - /// - /// - /// - public static void Error(string message, Exception exception) - { - Current.Logger.Error(typeof(T), message, exception); - } - - public static void Error(Type callingType, string message, Exception exception) - { - Current.Logger.Error(callingType, message, exception); - } - - #endregion - - #region Warn - - public static void Warn(Type callingType, string message, params Func[] formatItems) - { - Current.Logger.Warn(callingType, () => string.Format(message, formatItems.Select(x => x.Invoke()).ToArray())); - } - - [Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")] - public static void Warn(Type callingType, string message, bool showHttpTrace, params Func[] formatItems) - { - if (callingType == null) throw new ArgumentNullException(nameof(callingType)); - if (string.IsNullOrEmpty(message)) throw new ArgumentNullOrEmptyException(nameof(message)); - - if (showHttpTrace && HttpContext.Current != null) - { - HttpContext.Current.Trace.Warn(callingType.Name, string.Format(message, formatItems.Select(x => x.Invoke()).ToArray())); - } - - Current.Logger.Warn(callingType, () => string.Format(message, formatItems.Select(x => x.Invoke()).ToArray())); - } - - [Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")] - public static void WarnWithException(Type callingType, string message, Exception e, params Func[] formatItems) - { - WarnWithException(callingType, message, false, e, formatItems); - } - - [Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")] - public static void WarnWithException(Type callingType, string message, bool showHttpTrace, Exception e, params Func[] formatItems) - { - if (e == null) throw new ArgumentNullException(nameof(e)); - if (callingType == null) throw new ArgumentNullException(nameof(callingType)); - if (string.IsNullOrEmpty(message)) throw new ArgumentNullOrEmptyException(nameof(message)); - - if (showHttpTrace && HttpContext.Current != null) - { - HttpContext.Current.Trace.Warn( - callingType.Name, - string.Format(message, formatItems.Select(x => x.Invoke()).ToArray()), - e); - } - - Current.Logger.Warn(callingType, e, string.Format(message, formatItems.Select(x => x.Invoke()).ToArray())); - } - - /// - /// Adds a warn log - /// - /// - /// - /// - public static void Warn(string message, params Func[] formatItems) - { - Warn(typeof(T), message, formatItems); - } - - [Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")] - public static void Warn(string message, bool showHttpTrace, params Func[] formatItems) - { - Warn(typeof(T), message, showHttpTrace, formatItems); - } - - [Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")] - public static void WarnWithException(string message, Exception e, params Func[] formatItems) - { - WarnWithException(typeof(T), message, e, formatItems); - } - - [Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")] - public static void WarnWithException(string message, bool showHttpTrace, Exception e, params Func[] formatItems) - { - WarnWithException(typeof(T), message, showHttpTrace, e, formatItems); - } - - #endregion - - #region Info - /// - /// Traces a message, only generating the message if tracing is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled. - /// - /// - /// The delegate to generate a message. - /// - public static void Info(Func generateMessage) - { - Info(typeof(T), generateMessage); - } - - /// - /// Traces if tracing is enabled. - /// - /// - /// - public static void Info(Type callingType, Func generateMessage) - { - Current.Logger.Info(callingType, generateMessage); - } - - /// - /// Traces if tracing is enabled. - /// - /// The type for the logging namespace. - /// The message format. - /// The format items. - public static void Info(Type type, string generateMessageFormat, params Func[] formatItems) - { - Current.Logger.Info(type, string.Format(generateMessageFormat, formatItems.Select(x => x.Invoke()).ToArray())); - } - - /// - /// Traces a message, only generating the message if tracing is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled. - /// - /// - /// The generate message format. - /// The format items. - /// - public static void Info(string generateMessageFormat, params Func[] formatItems) - { - Info(typeof(T), generateMessageFormat, formatItems); - } - #endregion - - #region Debug - /// - /// Debugs a message, only generating the message if tracing is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled. - /// - /// - /// The delegate to generate a message. - /// - public static void Debug(Func generateMessage) - { - Debug(typeof(T), generateMessage); - } - - /// - /// Debugs if tracing is enabled. - /// - /// - /// - public static void Debug(Type callingType, Func generateMessage) - { - Current.Logger.Debug(callingType, generateMessage); - } - - /// - /// Debugs if tracing is enabled. - /// - /// The type for the logging namespace. - /// The message format. - /// The format items. - public static void Debug(Type type, string generateMessageFormat, params Func[] formatItems) - { - Current.Logger.Debug(type, string.Format(generateMessageFormat, formatItems.Select(x => x.Invoke()).ToArray())); - } - - /// - /// Debugs a message, only generating the message if debug is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled. - /// - /// - /// The generate message format. - /// The format items. - /// - public static void Debug(string generateMessageFormat, params Func[] formatItems) - { - Debug(typeof(T), generateMessageFormat, formatItems); - } - - /// - /// Debugs a message and also writes to the TraceContext specified, useful for when you would like the debug - /// output also displayed in the Http trace output. - /// - /// - /// - /// - /// - [Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")] - public static void Debug(string generateMessageFormat, bool showHttpTrace, params Func[] formatItems) - { - if (showHttpTrace && HttpContext.Current != null) - { - HttpContext.Current.Trace.Write( - typeof(T).Name, - string.Format(generateMessageFormat, formatItems.Select(x => x()).ToArray())); - } - Debug(typeof(T), generateMessageFormat, formatItems); - } - - #endregion - - } -} diff --git a/src/Umbraco.Compat7/Core/Logging/LoggerResolver.cs b/src/Umbraco.Compat7/Core/Logging/LoggerResolver.cs deleted file mode 100644 index c98ae29962..0000000000 --- a/src/Umbraco.Compat7/Core/Logging/LoggerResolver.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using CoreCurrent = Umbraco.Core.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.Logging -{ - public class LoggerResolver - { - private LoggerResolver() - { } - - public static bool HasCurrent => true; - - public static LoggerResolver Current { get; } - = new LoggerResolver(); - - public ILogger Logger => CoreCurrent.Logger; - - public void SetLogger(ILogger logger) - { - throw new NotSupportedException("The logger is determined by the UmbracoApplicationBase and cannot be modified afterwards." - + " To use a different logger, override the UmbracoApplicationBase (global.asax) class."); - } - } -} diff --git a/src/Umbraco.Compat7/Core/Logging/ProfilerResolver.cs b/src/Umbraco.Compat7/Core/Logging/ProfilerResolver.cs deleted file mode 100644 index 08263be451..0000000000 --- a/src/Umbraco.Compat7/Core/Logging/ProfilerResolver.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using CoreCurrent = Umbraco.Core.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.Logging -{ - public class ProfilerResolver - { - private ProfilerResolver() - { } - - public static bool HasCurrent => true; - - public static ProfilerResolver Current { get; } - = new ProfilerResolver(); - - public IProfiler Profiler => CoreCurrent.Profiler; - - public void SetProfiler(IProfiler profiler) - { - throw new NotSupportedException("The profiler is configured during the IRuntime Compose() method. Implement a" - + " custom IRuntime if you need to specify your own custom profiler."); - } - } -} diff --git a/src/Umbraco.Compat7/Core/Models/PublishedContent/PublishedContentModelFactoryResolver.cs b/src/Umbraco.Compat7/Core/Models/PublishedContent/PublishedContentModelFactoryResolver.cs deleted file mode 100644 index 1f4ab8acf9..0000000000 --- a/src/Umbraco.Compat7/Core/Models/PublishedContent/PublishedContentModelFactoryResolver.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Umbraco.Core.Composing; -using CoreCurrent = Umbraco.Core.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.Models.PublishedContent -{ - public class PublishedContentModelFactoryResolver - { - private PublishedContentModelFactoryResolver() - { } - - public static PublishedContentModelFactoryResolver Current { get; } = new PublishedContentModelFactoryResolver(); - - public static bool HasCurrent => true; - - public void SetFactory(IPublishedModelFactory factory) - { - CoreCurrent.Container.RegisterSingleton(_ => factory); - } - - public IPublishedModelFactory Factory => CoreCurrent.PublishedModelFactory; - } -} diff --git a/src/Umbraco.Compat7/Core/ObjectResolution/LazyManyObjectsResolverBase.cs b/src/Umbraco.Compat7/Core/ObjectResolution/LazyManyObjectsResolverBase.cs deleted file mode 100644 index d9b0dbc4d4..0000000000 --- a/src/Umbraco.Compat7/Core/ObjectResolution/LazyManyObjectsResolverBase.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using Umbraco.Core.Composing; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.ObjectResolution -{ - public abstract class LazyManyObjectsResolverBase - where TBuilder : LazyCollectionBuilderBase - where TCollection : IBuilderCollection - { - protected LazyManyObjectsResolverBase(TBuilder builder) - { - Builder = builder; - } - - protected TBuilder Builder { get; } - - public static bool HasCurrent => true; - - /// - /// Removes types from the list of types, once it has been lazily evaluated, and before actual objects are instanciated. - /// - /// The type to remove. - public void RemoveType(Type value) - { - Builder.Exclude(value); - } - - /// - /// Lazily adds types from a function producing types. - /// - /// The functions producing types, to add. - public void AddTypeListDelegate(Func> typeListProducer) - { - Builder.Add(typeListProducer); - } - - /// - /// Lazily adds a type from an actual type. - /// - /// The actual type, to add. - /// The type is converted to a lazy type. - public void AddType(Type value) - { - Builder.Add(value); - } - - /// - /// Clears all lazy types - /// - public void Clear() - { - Builder.Clear(); - } - } -} diff --git a/src/Umbraco.Compat7/Core/ObjectResolution/ManyObjectsResolverBase.cs b/src/Umbraco.Compat7/Core/ObjectResolution/ManyObjectsResolverBase.cs deleted file mode 100644 index 3b45998fee..0000000000 --- a/src/Umbraco.Compat7/Core/ObjectResolution/ManyObjectsResolverBase.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections.Generic; -using Umbraco.Core.Composing; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.ObjectResolution -{ - public abstract class ManyObjectsResolverBase - where TBuilder : OrderedCollectionBuilderBase - where TCollection : IBuilderCollection - { - private readonly TBuilder _builder; - - protected ManyObjectsResolverBase(TBuilder builder) - { - _builder = builder; - } - - public static bool HasCurrent => true; - - public void RemoveType(Type value) - { - _builder.Remove(value); - } - - public void RemoveType() - where T : TItem - { - _builder.Remove(); - } - - protected void AddTypes(IEnumerable types) - { - _builder.Append(types); - } - - public void AddType(Type value) - { - _builder.Append(value); - } - - public void AddType() - where T : TItem - { - _builder.Append(); - } - - public void Clear() - { - _builder.Clear(); - } - - public void InsertType(int index, Type value) - { - _builder.Insert(index, value); - } - - public void InsertType(Type value) - { - _builder.Insert(value); - } - - public void InsertType(int index) - where T : TItem - { - _builder.Insert(index); - } - - public void InsertType() - where T : TItem - { - _builder.Insert(); - } - - public void InsertTypeBefore(Type existingType, Type value) - { - _builder.InsertBefore(existingType, value); - } - - public void InsertTypeBefore() - where TExisting : TItem - where T : TItem - { - _builder.InsertBefore(); - } - - public bool ContainsType(Type value) - { - return _builder.Has(value); - } - - public IEnumerable GetTypes() - { - return _builder.GetTypes(); - } - - public bool ContainsType() - where T : TItem - { - return _builder.Has(); - } - } -} diff --git a/src/Umbraco.Compat7/Core/ObjectResolution/WeightedObjectsResolverBase.cs b/src/Umbraco.Compat7/Core/ObjectResolution/WeightedObjectsResolverBase.cs deleted file mode 100644 index d665cd6be5..0000000000 --- a/src/Umbraco.Compat7/Core/ObjectResolution/WeightedObjectsResolverBase.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections.Generic; -using Umbraco.Core.Composing; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.ObjectResolution -{ - public class WeightedObjectsResolverBase - where TBuilder : WeightedCollectionBuilderBase - where TCollection : IBuilderCollection - { - private readonly TBuilder _builder; - - protected WeightedObjectsResolverBase(TBuilder builder) - { - _builder = builder; - } - - public static bool HasCurrent => true; - - public void RemoveType(Type value) - { - _builder.Remove(value); - } - - public void RemoveType() - where T : TItem - { - _builder.Remove(); - } - - protected void AddTypes(IEnumerable types) - { - _builder.Add(types); - } - - public void AddType(Type value) - { - _builder.Add(value); - } - - public void AddType() - where T : TItem - { - _builder.Add(); - } - - public void Clear() - { - _builder.Clear(); - } - - public void InsertType(int index, Type value) - { - _builder.Add(value); - } - - public void InsertType(Type value) - { - _builder.Add(value); - } - - public void InsertType(int index) - where T : TItem - { - _builder.Add(); - } - - public void InsertType() - where T : TItem - { - _builder.Add(); - } - - public void InsertTypeBefore(Type existingType, Type value) - { - _builder.Add(value); - } - - public void InsertTypeBefore() - where TExisting : TItem - where T : TItem - { - _builder.Add(); - } - - public bool ContainsType(Type value) - { - return _builder.Has(value); - } - - public IEnumerable GetTypes() - { - return _builder.GetTypes(); - } - - public bool ContainsType() - where T : TItem - { - return _builder.Has(); - } - } -} diff --git a/src/Umbraco.Compat7/Core/PropertyEditors/PropertyEditorResolver.cs b/src/Umbraco.Compat7/Core/PropertyEditors/PropertyEditorResolver.cs deleted file mode 100644 index 8b063afcce..0000000000 --- a/src/Umbraco.Compat7/Core/PropertyEditors/PropertyEditorResolver.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.Composing.Current; -using LightInject; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.PropertyEditors -{ - public class PropertyEditorResolver : LazyManyObjectsResolverBase - { - private PropertyEditorResolver(DataEditorCollectionBuilder builder) - : base(builder) - { } - - public static PropertyEditorResolver Current { get; } - = new PropertyEditorResolver(CoreCurrent.Container.GetInstance()); - - public IEnumerable PropertyEditors => CoreCurrent.PropertyEditors; - - public IDataEditor GetByAlias(string alias) => CoreCurrent.PropertyEditors[alias]; - } -} diff --git a/src/Umbraco.Compat7/Core/PropertyEditors/PropertyValueConvertersResolver.cs b/src/Umbraco.Compat7/Core/PropertyEditors/PropertyValueConvertersResolver.cs deleted file mode 100644 index 1e31de05ac..0000000000 --- a/src/Umbraco.Compat7/Core/PropertyEditors/PropertyValueConvertersResolver.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.Composing.Current; -using LightInject; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.PropertyEditors -{ - public class PropertyValueConvertersResolver : ManyObjectsResolverBase - { - private PropertyValueConvertersResolver(PropertyValueConverterCollectionBuilder builder) - : base(builder) - { } - - public static PropertyValueConvertersResolver Current { get; } - = new PropertyValueConvertersResolver(CoreCurrent.Container.GetInstance()); - - public IEnumerable Converters => CoreCurrent.PropertyValueConverters; - } -} diff --git a/src/Umbraco.Compat7/Core/Strings/ShortStringHelperResolver.cs b/src/Umbraco.Compat7/Core/Strings/ShortStringHelperResolver.cs deleted file mode 100644 index f4929154fa..0000000000 --- a/src/Umbraco.Compat7/Core/Strings/ShortStringHelperResolver.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Umbraco.Core.Composing; -using CoreCurrent = Umbraco.Core.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.Strings -{ - public class ShortStringHelperResolver - { - private ShortStringHelperResolver() - { } - - public static bool HasCurrent => true; - - public static ShortStringHelperResolver Current { get; } - = new ShortStringHelperResolver(); - - public IShortStringHelper Helper => CoreCurrent.ShortStringHelper; - - public void SetHelper(IShortStringHelper helper) - { - CoreCurrent.Container.RegisterSingleton(_ => helper); - } - } -} diff --git a/src/Umbraco.Compat7/Core/Strings/UrlSegmentProviderResolver.cs b/src/Umbraco.Compat7/Core/Strings/UrlSegmentProviderResolver.cs deleted file mode 100644 index 2677ddb618..0000000000 --- a/src/Umbraco.Compat7/Core/Strings/UrlSegmentProviderResolver.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.Composing.Current; -using LightInject; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.Strings -{ - public class UrlSegmentProviderResolver : ManyObjectsResolverBase - { - private UrlSegmentProviderResolver(UrlSegmentProviderCollectionBuilder builder) - : base(builder) - { } - - public static UrlSegmentProviderResolver Current { get; } - = new UrlSegmentProviderResolver(CoreCurrent.Container.GetInstance()); - - public IEnumerable Providers => CoreCurrent.UrlSegmentProviders; - } -} diff --git a/src/Umbraco.Compat7/Core/Sync/ServerMessengerResolver.cs b/src/Umbraco.Compat7/Core/Sync/ServerMessengerResolver.cs deleted file mode 100644 index b4316335e3..0000000000 --- a/src/Umbraco.Compat7/Core/Sync/ServerMessengerResolver.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Umbraco.Core.Composing; -using CoreCurrent = Umbraco.Core.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.Sync -{ - public class ServerMessengerResolver - { - private ServerMessengerResolver() - { } - - public static bool HasCurrent => true; - - public static ServerMessengerResolver Current { get; } - = new ServerMessengerResolver(); - - public IServerMessenger Messenger => CoreCurrent.ServerMessenger; - - public void SetServerMessenger(IServerMessenger messenger) - { - CoreCurrent.Container.RegisterSingleton(_ => messenger); - } - } -} diff --git a/src/Umbraco.Compat7/Core/Sync/ServerRegistrarResolver.cs b/src/Umbraco.Compat7/Core/Sync/ServerRegistrarResolver.cs deleted file mode 100644 index 156d1c2968..0000000000 --- a/src/Umbraco.Compat7/Core/Sync/ServerRegistrarResolver.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Umbraco.Core.Composing; -using CoreCurrent = Umbraco.Core.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Core.Sync -{ - public class ServerRegistrarResolver - { - private ServerRegistrarResolver() - { } - - public static bool HasCurrent => true; - - public static ServerRegistrarResolver Current { get; } - = new ServerRegistrarResolver(); - - public IServerRegistrar Registrar => CoreCurrent.ServerRegistrar; - - public void SetServerRegistrar(IServerRegistrar registrar) - { - CoreCurrent.Container.RegisterSingleton(_ => registrar); - } - } -} diff --git a/src/Umbraco.Compat7/Properties/AssemblyInfo.cs b/src/Umbraco.Compat7/Properties/AssemblyInfo.cs deleted file mode 100644 index 412c975d0b..0000000000 --- a/src/Umbraco.Compat7/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("Umbraco.Compat7")] -[assembly: AssemblyDescription("Umbraco v7 compatibility layer for v8.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyProduct("Umbraco CMS")] - -[assembly: ComVisible(false)] -[assembly: Guid("185e098f-5706-4b97-b404-eb974f05f633")] diff --git a/src/Umbraco.Compat7/Umbraco.Compat7.csproj b/src/Umbraco.Compat7/Umbraco.Compat7.csproj deleted file mode 100644 index bd22959264..0000000000 --- a/src/Umbraco.Compat7/Umbraco.Compat7.csproj +++ /dev/null @@ -1,110 +0,0 @@ - - - - - v4.7 - false - {185E098F-5706-4B97-B404-EB974F05F633} - Library - Umbraco.Compat7 - Umbraco.Compat7 - ..\ - - - - true - full - false - bin\Debug\ - TRACE;DEBUG - prompt - 4 - latest - - - pdbonly - true - bin\Release\ - TRACE;COMPAT7 - prompt - 4 - bin\Release\Umbraco.Compat7.xml - latest - - - - - - - - - - - - - - - - - - - Umbraco.Core - - - {651e1350-91b6-44b7-bd60-7207006d7003} - Umbraco.Web - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Properties\SolutionInfo.cs - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Umbraco.Compat7/Web/HealthCheck/HealthCheckResolver.cs b/src/Umbraco.Compat7/Web/HealthCheck/HealthCheckResolver.cs deleted file mode 100644 index ea5334239a..0000000000 --- a/src/Umbraco.Compat7/Web/HealthCheck/HealthCheckResolver.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.Composing.Current; -using LightInject; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.HealthCheck -{ - public class HealthCheckResolver : LazyManyObjectsResolverBase - { - private HealthCheckResolver(HealthCheckCollectionBuilder builder) - : base(builder) - { } - - public static HealthCheckResolver Current { get; } - = new HealthCheckResolver(CoreCurrent.Container.GetInstance()); - - public IEnumerable HealthChecks => Builder.CreateCollection(); // transient - } -} diff --git a/src/Umbraco.Compat7/Web/Media/ThumbnailProvidersResolver.cs b/src/Umbraco.Compat7/Web/Media/ThumbnailProvidersResolver.cs deleted file mode 100644 index 9b76be23e9..0000000000 --- a/src/Umbraco.Compat7/Web/Media/ThumbnailProvidersResolver.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core.Media; -using Umbraco.Core.ObjectResolution; -using Umbraco.Web.Media.ThumbnailProviders; -using WebCurrent = Umbraco.Web.Composing.Current; -using LightInject; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Media -{ - public class ThumbnailProvidersResolver : WeightedObjectsResolverBase - { - private ThumbnailProvidersResolver(ThumbnailProviderCollectionBuilder builder) - : base(builder) - { } - - public static ThumbnailProvidersResolver Current { get; } - = new ThumbnailProvidersResolver(WebCurrent.Container.GetInstance()); - - public IEnumerable Providers => WebCurrent.ThumbnailProviders; - - public string GetThumbnailUrl(string fileUrl) => WebCurrent.ThumbnailProviders.GetThumbnailUrl(fileUrl); - } -} diff --git a/src/Umbraco.Compat7/Web/Models/IRenderModel.cs b/src/Umbraco.Compat7/Web/Models/IRenderModel.cs deleted file mode 100644 index 699a37fcd8..0000000000 --- a/src/Umbraco.Compat7/Web/Models/IRenderModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Umbraco.Core.Models.PublishedContent; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Models -{ - public interface IRenderModel - { - IPublishedContent Content { get; } - } -} diff --git a/src/Umbraco.Compat7/Web/Models/RenderModel.cs b/src/Umbraco.Compat7/Web/Models/RenderModel.cs deleted file mode 100644 index c843d48388..0000000000 --- a/src/Umbraco.Compat7/Web/Models/RenderModel.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Globalization; -using Umbraco.Core.Models.PublishedContent; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Models -{ - public class RenderModel : IRenderModel - { - public RenderModel(IPublishedContent content, CultureInfo culture) - { - if (content == null) throw new ArgumentNullException(nameof(content)); - if (culture == null) throw new ArgumentNullException(nameof(culture)); - Content = content; - CurrentCulture = culture; - } - - public RenderModel(IPublishedContent content) - { - if (content == null) throw new ArgumentNullException(nameof(content)); - if (UmbracoContext.Current == null) - { - throw new InvalidOperationException("Cannot construct a RenderModel without specifying a CultureInfo when no UmbracoContext has been initialized"); - } - Content = content; - CurrentCulture = UmbracoContext.Current.PublishedRequest.Culture; - } - - /// - /// Returns the current IPublishedContent object - /// - public IPublishedContent Content { get; private set; } - - /// - /// Returns the current Culture assigned to the page being rendered - /// - public CultureInfo CurrentCulture { get; private set; } - } -} diff --git a/src/Umbraco.Compat7/Web/Models/RenderModelOfTContent.cs b/src/Umbraco.Compat7/Web/Models/RenderModelOfTContent.cs deleted file mode 100644 index bb23ac6792..0000000000 --- a/src/Umbraco.Compat7/Web/Models/RenderModelOfTContent.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Globalization; -using Umbraco.Core.Models.PublishedContent; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Models -{ - public class RenderModel : RenderModel - where TContent : IPublishedContent - { - public RenderModel(TContent content, CultureInfo culture) - : base(content, culture) - { - Content = content; - } - - public RenderModel(TContent content) - : base(content) - { - Content = content; - } - - public new TContent Content { get; private set; } - } -} diff --git a/src/Umbraco.Compat7/Web/Mvc/DefaultRenderMvcControllerResolver.cs b/src/Umbraco.Compat7/Web/Mvc/DefaultRenderMvcControllerResolver.cs deleted file mode 100644 index 28e4eacadb..0000000000 --- a/src/Umbraco.Compat7/Web/Mvc/DefaultRenderMvcControllerResolver.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using WebCurrent = Umbraco.Web.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Mvc -{ - public class DefaultRenderMvcControllerResolver - { - private DefaultRenderMvcControllerResolver() - { } - - public static bool HasCurrent => true; - - public static DefaultRenderMvcControllerResolver Current { get; } - = new DefaultRenderMvcControllerResolver(); - - public Type GetDefaultControllerType() => WebCurrent.DefaultRenderMvcControllerType; - - public void SetDefaultControllerType(Type type) - { - WebCurrent.DefaultRenderMvcControllerType = type; - } - } -} diff --git a/src/Umbraco.Compat7/Web/Mvc/FilteredControllerFactoriesResolver.cs b/src/Umbraco.Compat7/Web/Mvc/FilteredControllerFactoriesResolver.cs deleted file mode 100644 index ceec453c3d..0000000000 --- a/src/Umbraco.Compat7/Web/Mvc/FilteredControllerFactoriesResolver.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.Composing.Current; -using WebCurrent = Umbraco.Web.Composing.Current; -using LightInject; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Mvc -{ - public class FilteredControllerFactoriesResolver : ManyObjectsResolverBase - { - public FilteredControllerFactoriesResolver(FilteredControllerFactoryCollectionBuilder builder) - : base(builder) - { } - - public static FilteredControllerFactoriesResolver Current { get; } - = new FilteredControllerFactoriesResolver(CoreCurrent.Container.GetInstance()); - - public IEnumerable Factories => WebCurrent.FilteredControllerFactories; - } -} diff --git a/src/Umbraco.Compat7/Web/Mvc/UmbracoTemplatePage.cs b/src/Umbraco.Compat7/Web/Mvc/UmbracoTemplatePage.cs deleted file mode 100644 index 70124ab3c9..0000000000 --- a/src/Umbraco.Compat7/Web/Mvc/UmbracoTemplatePage.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Umbraco.Web.Models; -//using Umbraco.Core.Dynamics; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Mvc -{ - /// - /// The View that front-end templates inherit from - /// - public abstract class UmbracoTemplatePage : UmbracoViewPage - { - private object _currentPage; - - /// - /// Returns the content as a dynamic object - /// - public dynamic CurrentPage - { - get - { - // it's invalid to create a DynamicPublishedContent around a null content anyway - // fixme - should we return null or DynamicNull.Null? - if (Model == null || Model.Content == null) return null; - //return _currentPage ?? (_currentPage = Model.Content.AsDynamic()); - return _currentPage ?? (_currentPage = Model.Content); - } - } - } -} diff --git a/src/Umbraco.Compat7/Web/Mvc/UmbracoTemplatePageOfTContent.cs b/src/Umbraco.Compat7/Web/Mvc/UmbracoTemplatePageOfTContent.cs deleted file mode 100644 index e73685b134..0000000000 --- a/src/Umbraco.Compat7/Web/Mvc/UmbracoTemplatePageOfTContent.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Umbraco.Core.Models.PublishedContent; -using Umbraco.Web.Models; -//using Umbraco.Core.Dynamics; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Mvc -{ - public abstract class UmbracoTemplatePage : UmbracoViewPage> - where TContent : IPublishedContent - { - private object _currentPage; - - /// - /// Returns the content as a dynamic object - /// - public dynamic CurrentPage - { - get - { - // it's invalid to create a DynamicPublishedContent around a null content anyway - // fixme - should we return null or DynamicNull.Null? - if (Model == null || Model.Content == null) return null; - //return _currentPage ?? (_currentPage = Model.Content.AsDynamic()); - return _currentPage ?? (_currentPage = Model.Content); - } - } - } -} diff --git a/src/Umbraco.Compat7/Web/PublishedCache/PublishedSnapshotServiceResolver.cs b/src/Umbraco.Compat7/Web/PublishedCache/PublishedSnapshotServiceResolver.cs deleted file mode 100644 index 13bbfd72b9..0000000000 --- a/src/Umbraco.Compat7/Web/PublishedCache/PublishedSnapshotServiceResolver.cs +++ /dev/null @@ -1,15 +0,0 @@ -using WebCurrent = Umbraco.Web.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.PublishedCache -{ - public class PublishedSnapshotServiceResolver - { - private PublishedSnapshotServiceResolver() - { } - - public static PublishedSnapshotServiceResolver Current { get; } = new PublishedSnapshotServiceResolver(); - - public IPublishedSnapshotService Service => WebCurrent.PublishedSnapshotService; - } -} diff --git a/src/Umbraco.Compat7/Web/Routing/ContentFinderResolver.cs b/src/Umbraco.Compat7/Web/Routing/ContentFinderResolver.cs deleted file mode 100644 index 620dcfac8d..0000000000 --- a/src/Umbraco.Compat7/Web/Routing/ContentFinderResolver.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.Composing.Current; -using WebCurrent = Umbraco.Web.Composing.Current; -using LightInject; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Routing -{ - public class ContentFinderResolver : ManyObjectsResolverBase - { - private ContentFinderResolver(ContentFinderCollectionBuilder builder) - : base(builder) - { } - - public static ContentFinderResolver Current { get; } - = new ContentFinderResolver(CoreCurrent.Container.GetInstance()); - - public IEnumerable Finders => WebCurrent.ContentFinders; - } -} diff --git a/src/Umbraco.Compat7/Web/Routing/ContentLastChangeFinderResolver.cs b/src/Umbraco.Compat7/Web/Routing/ContentLastChangeFinderResolver.cs deleted file mode 100644 index bb46f79bf4..0000000000 --- a/src/Umbraco.Compat7/Web/Routing/ContentLastChangeFinderResolver.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using Umbraco.Core.Composing; -using CoreCurrent = Umbraco.Core.Composing.Current; -using WebCurrent = Umbraco.Web.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Routing -{ - public class ContentLastChangeFinderResolver - { - private ContentLastChangeFinderResolver() - { } - - public static ContentLastChangeFinderResolver Current { get; } = new ContentLastChangeFinderResolver(); - - public IContentFinder Finder => WebCurrent.LastChanceContentFinder; - - public void SetFinder(IContentFinder finder) - { - if (finder == null) throw new ArgumentNullException(nameof(finder)); - var lastChance = finder as IContentLastChanceFinder ?? new FinderWrapper(finder); - CoreCurrent.Container.RegisterSingleton(_ => lastChance); - } - - private class FinderWrapper : IContentLastChanceFinder - { - private readonly IContentFinder _inner; - - public FinderWrapper(IContentFinder inner) - { - _inner = inner; - } - - public bool TryFindContent(PublishedRequest frequest) - { - return _inner.TryFindContent(frequest); - } - } - } -} diff --git a/src/Umbraco.Compat7/Web/Routing/SiteDomainHelperResolver.cs b/src/Umbraco.Compat7/Web/Routing/SiteDomainHelperResolver.cs deleted file mode 100644 index ee3bb77f68..0000000000 --- a/src/Umbraco.Compat7/Web/Routing/SiteDomainHelperResolver.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Umbraco.Core.Composing; -using CoreCurrent = Umbraco.Core.Composing.Current; -using WebCurrent = Umbraco.Web.Composing.Current; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Routing -{ - public class SiteDomainHelperResolver - { - private SiteDomainHelperResolver() - { } - - public static bool HasCurrent => true; - - public static SiteDomainHelperResolver Current { get; } - = new SiteDomainHelperResolver(); - - public ISiteDomainHelper Helper => WebCurrent.SiteDomainHelper; - - public void SetHelper(ISiteDomainHelper helper) - { - CoreCurrent.Container.RegisterSingleton(_ => helper); - } - } -} diff --git a/src/Umbraco.Compat7/Web/Routing/UrlProviderResolver.cs b/src/Umbraco.Compat7/Web/Routing/UrlProviderResolver.cs deleted file mode 100644 index 0a3a8e2b38..0000000000 --- a/src/Umbraco.Compat7/Web/Routing/UrlProviderResolver.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.Composing.Current; -using WebCurrent = Umbraco.Web.Composing.Current; -using LightInject; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web.Routing -{ - public class UrlProviderResolver : ManyObjectsResolverBase - { - private UrlProviderResolver(UrlProviderCollectionBuilder builder) - : base(builder) - { } - - public static UrlProviderResolver Current { get; } - = new UrlProviderResolver(CoreCurrent.Container.GetInstance()); - - public IEnumerable Providers => WebCurrent.UrlProviders; - } -} diff --git a/src/Umbraco.Compat7/Web/UmbracoHelperExtensions.cs b/src/Umbraco.Compat7/Web/UmbracoHelperExtensions.cs deleted file mode 100644 index 60f7cb5a4a..0000000000 --- a/src/Umbraco.Compat7/Web/UmbracoHelperExtensions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Umbraco.Core.Models.PublishedContent; - -// ReSharper disable once CheckNamespace -namespace Umbraco.Web -{ - public static class UmbracoHelperExtensions - { - // fixme - missing many more - - public static IPublishedContent TypedMedia(this UmbracoHelper helper, int id) - => helper.Media(id); - } -} diff --git a/src/Umbraco.Compat7/notes.txt b/src/Umbraco.Compat7/notes.txt deleted file mode 100644 index f153361aae..0000000000 --- a/src/Umbraco.Compat7/notes.txt +++ /dev/null @@ -1,41 +0,0 @@ - - -** Umbraco.Compat7 - -The purpose of Umbraco.Compat7 is to help support v7 sites in v8, by providing -an implementation of most of the important interfaces and services that have -been removed in v8. - -This includes: - -- ApplicationContext - compat: full - status: done - -- IApplicationEventHandler - compat: UmbracoApplicationBase ApplicationStarting & ApplicationStarted events - are gone. Use corresponding Compat7Component events instead, should be mostly - the same. - status: to be tested - -- Resolvers - compat: full - status: - base resolvers: done - resolvers: TODO - -- RenderModel, UmbracoTemplatePage - compat: will NOT support dynamics, so CurrentPage will prob not work - status: need to test RendeModel, not sure it works at all - -What else? - -- IPublishedContent GetPropertyValue extension methods -- ? - -** Building - -By default, Umbraco.Compat7 is built but not copied / nothing. -If the conditional symbol 'COMPAT7' is defined, it is copied to Umbraco.Web.UI/bin. -Currently, that symbol is defined for the DEBUG build. -Eventually it should become an extra NuGet package. diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 18b3d392de..eb3a2171d3 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -181,7 +181,7 @@ - + @@ -751,11 +751,9 @@ $(NuGetPackageFolders.Split(';')[0]) - - @@ -821,7 +819,6 @@ - diff --git a/src/umbraco.sln b/src/umbraco.sln index f810bd75ef..d627b5c9e8 100644 --- a/src/umbraco.sln +++ b/src/umbraco.sln @@ -28,7 +28,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B5BD12C1 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{227C3B55-80E5-4E7E-A802-BE16C5128B9D}" ProjectSection(SolutionItems) = preProject - ..\build\NuSpecs\UmbracoCms.Compat7.nuspec = ..\build\NuSpecs\UmbracoCms.Compat7.nuspec ..\build\NuSpecs\UmbracoCms.Core.nuspec = ..\build\NuSpecs\UmbracoCms.Core.nuspec ..\build\NuSpecs\UmbracoCms.nuspec = ..\build\NuSpecs\UmbracoCms.nuspec EndProjectSection @@ -85,12 +84,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{5B03EF4E EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests.Benchmarks", "Umbraco.Tests.Benchmarks\Umbraco.Tests.Benchmarks.csproj", "{86DEB346-089F-4106-89C8-D852B9CF2A33}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Compat7", "Umbraco.Compat7\Umbraco.Compat7.csproj", "{185E098F-5706-4B97-B404-EB974F05F633}" - ProjectSection(ProjectDependencies) = postProject - {651E1350-91B6-44B7-BD60-7207006D7003} = {651E1350-91B6-44B7-BD60-7207006D7003} - {31785BC3-256C-4613-B2F5-A1B0BDDED8C1} = {31785BC3-256C-4613-B2F5-A1B0BDDED8C1} - EndProjectSection -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -123,10 +116,6 @@ Global {86DEB346-089F-4106-89C8-D852B9CF2A33}.Debug|Any CPU.Build.0 = Debug|Any CPU {86DEB346-089F-4106-89C8-D852B9CF2A33}.Release|Any CPU.ActiveCfg = Release|Any CPU {86DEB346-089F-4106-89C8-D852B9CF2A33}.Release|Any CPU.Build.0 = Release|Any CPU - {185E098F-5706-4B97-B404-EB974F05F633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {185E098F-5706-4B97-B404-EB974F05F633}.Debug|Any CPU.Build.0 = Debug|Any CPU - {185E098F-5706-4B97-B404-EB974F05F633}.Release|Any CPU.ActiveCfg = Release|Any CPU - {185E098F-5706-4B97-B404-EB974F05F633}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE