Umbraco.Compat7.die.die.die

This commit is contained in:
Stephan
2018-04-13 11:02:16 +02:00
parent 1c70c34d57
commit ed3e693308
45 changed files with 10 additions and 1615 deletions

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms.Compat7</id>
<version>8.0.0</version>
<title>Umbraco Cms Compat7</title>
<authors>Umbraco HQ</authors>
<owners>Umbraco HQ</owners>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<projectUrl>http://umbraco.com/</projectUrl>
<iconUrl>http://umbraco.com/media/357769/100px_transparent.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Contains resources aiming at providing a better v7-to-v8 backward compatibility.</description>
<summary>Umbraco v7 compatibility layer for v8.</summary>
<language>en-US</language>
<tags>umbraco</tags>
<dependencies>
<dependency id="UmbracoCms.Core" version="[$version$]" />
</dependencies>
</metadata>
<files>
<file src="$BuildTmp$\bin\Umbraco.Compat7.dll" target="lib\Umbraco.Compat7.dll" />
<!--
<file src="..\_BuildOutput\bin\Umbraco.Compat7.xml" target="lib\Umbraco.Compat7.xml" />
-->
</files>
</package>

View File

@@ -21,7 +21,7 @@
<dependency id="Microsoft.Owin.Security.Cookies" version="[4.0.0, 5.0.0)" />
<dependency id="Microsoft.Owin.Security.OAuth" version="[4.0.0, 5.0.0)" />
<dependency id="Microsoft.Owin.Host.SystemWeb" version="[4.0.0, 5.0.0)" />
<dependency id="MiniProfiler" version="[3.2.0.157, 4.0.0)" />
<dependency id="MiniProfiler" version="[3.2.0.157, 3.9.999)" />
<dependency id="HtmlAgilityPack" version="[1.7.2, 2.0.0)" />
<dependency id="Lucene.Net" version="[3.0.3, 4.0.0.0)" />
<dependency id="MySql.Data" version="[6.10.6, 7.0.0)" />
@@ -33,7 +33,7 @@
<dependency id="LightInject.Web" version="[2.0.0, 3.0.0)" />
<dependency id="LightInject.WebApi" version="[2.0.0, 3.0.0)" />
<dependency id="Newtonsoft.Json" version="[11.0.2, 12.0.0)" />
<dependency id="Examine" version="[1.0.0-beta025, 3.0.0)" />
<dependency id="Examine" version="[1.0.0-beta025, 1.666.666)" />
<dependency id="ImageProcessor" version="[2.6.0, 3.0.0)" />
<dependency id="ImageProcessor.Web" version="[4.8.7, 5.0.0)" />
<dependency id="semver" version="[2.0.4, 3.0.0)" />
@@ -41,6 +41,8 @@
<dependency id="log4net" version="[2.0.8, 3.0.0)" />
<dependency id="System.Threading.Tasks.Dataflow" version="[4.8.0, 5.0.0)" />
<dependency id="System.ValueTuple" version="[4.4.0, 5.0.0)" />
<dependency id="NPoco" version="3.9.0" />
<dependency id="NuGet.Core" version="2.14.0" />
</dependencies>
</metadata>
<files>

View File

@@ -16,8 +16,7 @@
<tags>umbraco</tags>
<dependencies>
<dependency id="UmbracoCms.Core" version="[$version$]" />
<dependency id="Newtonsoft.Json" version="[11.0.2, 12.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[8.0.0-alpha.15, 9.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[8.0.0-alpha.17, 9.0.0)" />
<dependency id="Microsoft.AspNet.SignalR.Core" version="[2.2.3, 3.0.0)" />
</dependencies>
</metadata>

View File

@@ -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 }
})

View File

@@ -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<IApplicationEventHandler> _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<UmbracoApplicationBase>();
var logger = container.GetInstance<ILogger>();
var pluginManager = container.GetInstance<TypeLoader>();
var handlerTypes = pluginManager.GetTypes<IApplicationEventHandler>();
_handlers = handlerTypes.Select(Activator.CreateInstance).Cast<IApplicationEventHandler>().ToList();
foreach (var handler in _handlers)
logger.Debug<Compat7Component>($"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<Compat7Component>("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<Compat7Component>("An error occurred in an ApplicationStarting event handler", ex);
throw;
}
}
}
}

View File

@@ -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<IAction> Actions => WebCurrent.Actions;
}
}

View File

@@ -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<IUmbracoDatabaseFactory>());
}
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()
{ }
}
}

View File

@@ -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;
}
}

View File

@@ -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<CacheRefresherCollectionBuilder, CacheRefresherCollection, ICacheRefresher>
{
private CacheRefreshersResolver(CacheRefresherCollectionBuilder builder)
: base(builder)
{ }
public static CacheRefreshersResolver Current { get; }
= new CacheRefreshersResolver(CoreCurrent.Container.GetInstance<CacheRefresherCollectionBuilder>());
public IEnumerable<ICacheRefresher> CacheRefreshers => CoreCurrent.CacheRefreshers;
public ICacheRefresher GetById(Guid id) => CoreCurrent.CacheRefreshers[id];
}
}

View File

@@ -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;
/// <summary>
/// Initializes a new instance of the <see cref="Umbraco.Core.DatabaseContext"/> class.
/// </summary>
/// <param name="databaseFactory">A database factory.</param>
/// <remarks>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.</remarks>
public DatabaseContext(IUmbracoDatabaseFactory databaseFactory)
{
_databaseFactory = databaseFactory ?? throw new ArgumentNullException(nameof(databaseFactory));
}
/// <summary>
/// Gets the database Sql syntax.
/// </summary>
public ISqlSyntaxProvider SqlSyntax => _databaseFactory.SqlContext.SqlSyntax;
/// <summary>
/// Creates a Sql statement.
/// </summary>
public Sql<ISqlContext> Sql() => _databaseFactory.SqlContext.Sql();
/// <summary>
/// Creates a Sql statement.
/// </summary>
public Sql<ISqlContext> Sql(string sql, params object[] args) => _databaseFactory.SqlContext.Sql(sql, args);
/// <summary>
/// Creates a Query expression.
/// </summary>
public IQuery<T> Query<T>() => _databaseFactory.SqlContext.Query<T>();
/// <summary>
/// Gets an ambient database for doing CRUD operations against custom tables that resides in the Umbraco database.
/// </summary>
/// <remarks>Should not be used for operation against standard Umbraco tables; as services should be used instead.</remarks>
public IUmbracoDatabase Database => throw new NotImplementedException(); // there's no magic?
/// <summary>
/// Gets a value indicating whether the database is configured.
/// </summary>
/// <remarks>It does not necessarily mean that it is possible to
/// connect, nor that Umbraco is installed, nor up-to-date.</remarks>
public bool IsDatabaseConfigured => _databaseFactory.Configured;
/// <summary>
/// Gets a value indicating whether it is possible to connect to the database.
/// </summary>
public bool CanConnect => _databaseFactory.Configured && _databaseFactory.CanConnect;
}
}

View File

@@ -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);
}
}
}

View File

@@ -1,34 +0,0 @@
// ReSharper disable once CheckNamespace
using Umbraco.Core.Composing;
namespace Umbraco.Core
{
/// <summary>
/// Custom IApplicationStartupHandler that auto subscribes to the applications events
/// </summary>
public interface IApplicationEventHandler : IDiscoverable
{
/// <summary>
/// ApplicationContext is created and other static objects that require initialization have been setup
/// </summary>
/// <param name="umbracoApplication"></param>
/// <param name="applicationContext"></param>
void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext);
/// <summary>
/// All resolvers have been initialized but resolution is not frozen so they can be modified in this method
/// </summary>
/// <param name="umbracoApplication"></param>
/// <param name="applicationContext"></param>
void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext);
/// <summary>
/// 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.
/// </summary>
/// <param name="umbracoApplication"></param>
/// <param name="applicationContext"></param>
void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext);
}
}

View File

@@ -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
/// <summary>
/// Adds an error log
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="message"></param>
/// <param name="exception"></param>
public static void Error<T>(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<object>[] 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<object>[] 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<object>[] 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<object>[] 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()));
}
/// <summary>
/// Adds a warn log
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="message"></param>
/// <param name="formatItems"></param>
public static void Warn<T>(string message, params Func<object>[] 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<T>(string message, bool showHttpTrace, params Func<object>[] 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<T>(string message, Exception e, params Func<object>[] 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<T>(string message, bool showHttpTrace, Exception e, params Func<object>[] formatItems)
{
WarnWithException(typeof(T), message, showHttpTrace, e, formatItems);
}
#endregion
#region Info
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="generateMessage">The delegate to generate a message.</param>
/// <remarks></remarks>
public static void Info<T>(Func<string> generateMessage)
{
Info(typeof(T), generateMessage);
}
/// <summary>
/// Traces if tracing is enabled.
/// </summary>
/// <param name="callingType"></param>
/// <param name="generateMessage"></param>
public static void Info(Type callingType, Func<string> generateMessage)
{
Current.Logger.Info(callingType, generateMessage);
}
/// <summary>
/// Traces if tracing is enabled.
/// </summary>
/// <param name="type">The type for the logging namespace.</param>
/// <param name="generateMessageFormat">The message format.</param>
/// <param name="formatItems">The format items.</param>
public static void Info(Type type, string generateMessageFormat, params Func<object>[] formatItems)
{
Current.Logger.Info(type, string.Format(generateMessageFormat, formatItems.Select(x => x.Invoke()).ToArray()));
}
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="generateMessageFormat">The generate message format.</param>
/// <param name="formatItems">The format items.</param>
/// <remarks></remarks>
public static void Info<T>(string generateMessageFormat, params Func<object>[] formatItems)
{
Info(typeof(T), generateMessageFormat, formatItems);
}
#endregion
#region Debug
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="generateMessage">The delegate to generate a message.</param>
/// <remarks></remarks>
public static void Debug<T>(Func<string> generateMessage)
{
Debug(typeof(T), generateMessage);
}
/// <summary>
/// Debugs if tracing is enabled.
/// </summary>
/// <param name="callingType"></param>
/// <param name="generateMessage"></param>
public static void Debug(Type callingType, Func<string> generateMessage)
{
Current.Logger.Debug(callingType, generateMessage);
}
/// <summary>
/// Debugs if tracing is enabled.
/// </summary>
/// <param name="type">The type for the logging namespace.</param>
/// <param name="generateMessageFormat">The message format.</param>
/// <param name="formatItems">The format items.</param>
public static void Debug(Type type, string generateMessageFormat, params Func<object>[] formatItems)
{
Current.Logger.Debug(type, string.Format(generateMessageFormat, formatItems.Select(x => x.Invoke()).ToArray()));
}
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="generateMessageFormat">The generate message format.</param>
/// <param name="formatItems">The format items.</param>
/// <remarks></remarks>
public static void Debug<T>(string generateMessageFormat, params Func<object>[] formatItems)
{
Debug(typeof(T), generateMessageFormat, formatItems);
}
/// <summary>
/// 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.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="generateMessageFormat"></param>
/// <param name="showHttpTrace"></param>
/// <param name="formatItems"></param>
[Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")]
public static void Debug<T>(string generateMessageFormat, bool showHttpTrace, params Func<object>[] 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
}
}

View File

@@ -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.");
}
}
}

View File

@@ -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.");
}
}
}

View File

@@ -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;
}
}

View File

@@ -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<TBuilder, TCollection, TItem>
where TBuilder : LazyCollectionBuilderBase<TBuilder, TCollection, TItem>
where TCollection : IBuilderCollection<TItem>
{
protected LazyManyObjectsResolverBase(TBuilder builder)
{
Builder = builder;
}
protected TBuilder Builder { get; }
public static bool HasCurrent => true;
/// <summary>
/// Removes types from the list of types, once it has been lazily evaluated, and before actual objects are instanciated.
/// </summary>
/// <param name="value">The type to remove.</param>
public void RemoveType(Type value)
{
Builder.Exclude(value);
}
/// <summary>
/// Lazily adds types from a function producing types.
/// </summary>
/// <param name="typeListProducer">The functions producing types, to add.</param>
public void AddTypeListDelegate(Func<IEnumerable<Type>> typeListProducer)
{
Builder.Add(typeListProducer);
}
/// <summary>
/// Lazily adds a type from an actual type.
/// </summary>
/// <param name="value">The actual type, to add.</param>
/// <remarks>The type is converted to a lazy type.</remarks>
public void AddType(Type value)
{
Builder.Add(value);
}
/// <summary>
/// Clears all lazy types
/// </summary>
public void Clear()
{
Builder.Clear();
}
}
}

View File

@@ -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<TBuilder, TCollection, TItem>
where TBuilder : OrderedCollectionBuilderBase<TBuilder, TCollection, TItem>
where TCollection : IBuilderCollection<TItem>
{
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<T>()
where T : TItem
{
_builder.Remove<T>();
}
protected void AddTypes(IEnumerable<Type> types)
{
_builder.Append(types);
}
public void AddType(Type value)
{
_builder.Append(value);
}
public void AddType<T>()
where T : TItem
{
_builder.Append<T>();
}
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<T>(int index)
where T : TItem
{
_builder.Insert<T>(index);
}
public void InsertType<T>()
where T : TItem
{
_builder.Insert<T>();
}
public void InsertTypeBefore(Type existingType, Type value)
{
_builder.InsertBefore(existingType, value);
}
public void InsertTypeBefore<TExisting, T>()
where TExisting : TItem
where T : TItem
{
_builder.InsertBefore<TExisting, T>();
}
public bool ContainsType(Type value)
{
return _builder.Has(value);
}
public IEnumerable<Type> GetTypes()
{
return _builder.GetTypes();
}
public bool ContainsType<T>()
where T : TItem
{
return _builder.Has<T>();
}
}
}

View File

@@ -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<TBuilder, TCollection, TItem>
where TBuilder : WeightedCollectionBuilderBase<TBuilder, TCollection, TItem>
where TCollection : IBuilderCollection<TItem>
{
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<T>()
where T : TItem
{
_builder.Remove<T>();
}
protected void AddTypes(IEnumerable<Type> types)
{
_builder.Add(types);
}
public void AddType(Type value)
{
_builder.Add(value);
}
public void AddType<T>()
where T : TItem
{
_builder.Add<T>();
}
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<T>(int index)
where T : TItem
{
_builder.Add<T>();
}
public void InsertType<T>()
where T : TItem
{
_builder.Add<T>();
}
public void InsertTypeBefore(Type existingType, Type value)
{
_builder.Add(value);
}
public void InsertTypeBefore<TExisting, T>()
where TExisting : TItem
where T : TItem
{
_builder.Add<T>();
}
public bool ContainsType(Type value)
{
return _builder.Has(value);
}
public IEnumerable<Type> GetTypes()
{
return _builder.GetTypes();
}
public bool ContainsType<T>()
where T : TItem
{
return _builder.Has<T>();
}
}
}

View File

@@ -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<DataEditorCollectionBuilder, DataEditorCollection, IDataEditor>
{
private PropertyEditorResolver(DataEditorCollectionBuilder builder)
: base(builder)
{ }
public static PropertyEditorResolver Current { get; }
= new PropertyEditorResolver(CoreCurrent.Container.GetInstance<DataEditorCollectionBuilder>());
public IEnumerable<IDataEditor> PropertyEditors => CoreCurrent.PropertyEditors;
public IDataEditor GetByAlias(string alias) => CoreCurrent.PropertyEditors[alias];
}
}

View File

@@ -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<PropertyValueConverterCollectionBuilder, PropertyValueConverterCollection, IPropertyValueConverter>
{
private PropertyValueConvertersResolver(PropertyValueConverterCollectionBuilder builder)
: base(builder)
{ }
public static PropertyValueConvertersResolver Current { get; }
= new PropertyValueConvertersResolver(CoreCurrent.Container.GetInstance<PropertyValueConverterCollectionBuilder>());
public IEnumerable<IPropertyValueConverter> Converters => CoreCurrent.PropertyValueConverters;
}
}

View File

@@ -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);
}
}
}

View File

@@ -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<UrlSegmentProviderCollectionBuilder, UrlSegmentProviderCollection, IUrlSegmentProvider>
{
private UrlSegmentProviderResolver(UrlSegmentProviderCollectionBuilder builder)
: base(builder)
{ }
public static UrlSegmentProviderResolver Current { get; }
= new UrlSegmentProviderResolver(CoreCurrent.Container.GetInstance<UrlSegmentProviderCollectionBuilder>());
public IEnumerable<IUrlSegmentProvider> Providers => CoreCurrent.UrlSegmentProviders;
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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")]

View File

@@ -1,110 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<ProjectGuid>{185E098F-5706-4B97-B404-EB974F05F633}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>Umbraco.Compat7</AssemblyName>
<RootNamespace>Umbraco.Compat7</RootNamespace>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;COMPAT7</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\Umbraco.Compat7.xml</DocumentationFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<!-- note: NuGet deals with transitive references now -->
<PackageReference Include="LightInject" Version="5.1.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj">
<Name>Umbraco.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Umbraco.Web\Umbraco.Web.csproj">
<Project>{651e1350-91b6-44b7-bd60-7207006d7003}</Project>
<Name>Umbraco.Web</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Compat7Component.cs" />
<Compile Include="Core\ActionsResolver.cs" />
<Compile Include="Core\ApplicationContext.cs" />
<Compile Include="Core\ApplicationEventHandler.cs" />
<Compile Include="Core\Cache\CacheRefreshersResolver.cs" />
<Compile Include="Core\DatabaseContext.cs" />
<Compile Include="Core\Dictionary\CultureDictionaryFactoryResolver.cs" />
<Compile Include="Core\IApplicationEventHandler.cs" />
<Compile Include="Core\Logging\LoggerResolver.cs" />
<Compile Include="Core\Logging\LogHelper.cs" />
<Compile Include="Core\Logging\ProfilerResolver.cs" />
<Compile Include="Core\Models\PublishedContent\PublishedContentModelFactoryResolver.cs" />
<Compile Include="Core\ObjectResolution\LazyManyObjectsResolverBase.cs" />
<Compile Include="Core\ObjectResolution\ManyObjectsResolverBase.cs" />
<Compile Include="Core\ObjectResolution\WeightedObjectsResolverBase.cs" />
<Compile Include="Core\PropertyEditors\PropertyEditorResolver.cs" />
<Compile Include="Core\PropertyEditors\PropertyValueConvertersResolver.cs" />
<Compile Include="Core\Strings\ShortStringHelperResolver.cs" />
<Compile Include="Core\Strings\UrlSegmentProviderResolver.cs" />
<Compile Include="Core\Sync\ServerMessengerResolver.cs" />
<Compile Include="Core\Sync\ServerRegistrarResolver.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Web\HealthCheck\HealthCheckResolver.cs" />
<Compile Include="Web\Media\ThumbnailProvidersResolver.cs" />
<Compile Include="Web\Models\IRenderModel.cs" />
<Compile Include="Web\Models\RenderModel.cs" />
<Compile Include="Web\Models\RenderModelOfTContent.cs" />
<Compile Include="Web\Mvc\DefaultRenderMvcControllerResolver.cs" />
<Compile Include="Web\Mvc\FilteredControllerFactoriesResolver.cs" />
<Compile Include="Web\Mvc\UmbracoTemplatePage.cs" />
<Compile Include="Web\Mvc\UmbracoTemplatePageOfTContent.cs" />
<Compile Include="Web\PublishedCache\PublishedSnapshotServiceResolver.cs" />
<Compile Include="Web\Routing\ContentFinderResolver.cs" />
<Compile Include="Web\Routing\ContentLastChangeFinderResolver.cs" />
<Compile Include="Web\Routing\SiteDomainHelperResolver.cs" />
<Compile Include="Web\Routing\UrlProviderResolver.cs" />
<Compile Include="Web\UmbracoHelperExtensions.cs" />
<Compile Include="..\SolutionInfo.cs">
<Link>Properties\SolutionInfo.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="notes.txt" />
</ItemGroup>
<ItemGroup>
<Folder Include="Core\Persistence\" />
</ItemGroup>
<Target Name="AfterBuild" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND $([System.Text.RegularExpressions.Regex]::IsMatch($(DefineConstants), '^(.*;)*COMPAT7(;.*)*$'))">
<Copy SourceFiles="$(ProjectDir)bin\$(Configuration)\Umbraco.Compat7.dll" DestinationFolder="$(ProjectDir)..\Umbraco.Web.UI\bin" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="false" />
</Target>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -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<HealthCheckCollectionBuilder, HealthCheckCollection, HealthCheck>
{
private HealthCheckResolver(HealthCheckCollectionBuilder builder)
: base(builder)
{ }
public static HealthCheckResolver Current { get; }
= new HealthCheckResolver(CoreCurrent.Container.GetInstance<HealthCheckCollectionBuilder>());
public IEnumerable<HealthCheck> HealthChecks => Builder.CreateCollection(); // transient
}
}

View File

@@ -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<ThumbnailProviderCollectionBuilder, ThumbnailProviderCollection, IThumbnailProvider>
{
private ThumbnailProvidersResolver(ThumbnailProviderCollectionBuilder builder)
: base(builder)
{ }
public static ThumbnailProvidersResolver Current { get; }
= new ThumbnailProvidersResolver(WebCurrent.Container.GetInstance<ThumbnailProviderCollectionBuilder>());
public IEnumerable<IThumbnailProvider> Providers => WebCurrent.ThumbnailProviders;
public string GetThumbnailUrl(string fileUrl) => WebCurrent.ThumbnailProviders.GetThumbnailUrl(fileUrl);
}
}

View File

@@ -1,10 +0,0 @@
using Umbraco.Core.Models.PublishedContent;
// ReSharper disable once CheckNamespace
namespace Umbraco.Web.Models
{
public interface IRenderModel
{
IPublishedContent Content { get; }
}
}

View File

@@ -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;
}
/// <summary>
/// Returns the current IPublishedContent object
/// </summary>
public IPublishedContent Content { get; private set; }
/// <summary>
/// Returns the current Culture assigned to the page being rendered
/// </summary>
public CultureInfo CurrentCulture { get; private set; }
}
}

View File

@@ -1,24 +0,0 @@
using System.Globalization;
using Umbraco.Core.Models.PublishedContent;
// ReSharper disable once CheckNamespace
namespace Umbraco.Web.Models
{
public class RenderModel<TContent> : 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; }
}
}

View File

@@ -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;
}
}
}

View File

@@ -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<FilteredControllerFactoryCollectionBuilder, FilteredControllerFactoryCollection, IFilteredControllerFactory>
{
public FilteredControllerFactoriesResolver(FilteredControllerFactoryCollectionBuilder builder)
: base(builder)
{ }
public static FilteredControllerFactoriesResolver Current { get; }
= new FilteredControllerFactoriesResolver(CoreCurrent.Container.GetInstance<FilteredControllerFactoryCollectionBuilder>());
public IEnumerable<IFilteredControllerFactory> Factories => WebCurrent.FilteredControllerFactories;
}
}

View File

@@ -1,29 +0,0 @@
using Umbraco.Web.Models;
//using Umbraco.Core.Dynamics;
// ReSharper disable once CheckNamespace
namespace Umbraco.Web.Mvc
{
/// <summary>
/// The View that front-end templates inherit from
/// </summary>
public abstract class UmbracoTemplatePage : UmbracoViewPage<RenderModel>
{
private object _currentPage;
/// <summary>
/// Returns the content as a dynamic object
/// </summary>
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);
}
}
}
}

View File

@@ -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<TContent> : UmbracoViewPage<RenderModel<TContent>>
where TContent : IPublishedContent
{
private object _currentPage;
/// <summary>
/// Returns the content as a dynamic object
/// </summary>
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);
}
}
}
}

View File

@@ -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;
}
}

View File

@@ -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<ContentFinderCollectionBuilder, ContentFinderCollection, IContentFinder>
{
private ContentFinderResolver(ContentFinderCollectionBuilder builder)
: base(builder)
{ }
public static ContentFinderResolver Current { get; }
= new ContentFinderResolver(CoreCurrent.Container.GetInstance<ContentFinderCollectionBuilder>());
public IEnumerable<IContentFinder> Finders => WebCurrent.ContentFinders;
}
}

View File

@@ -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);
}
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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<UrlProviderCollectionBuilder, UrlProviderCollection, IUrlProvider>
{
private UrlProviderResolver(UrlProviderCollectionBuilder builder)
: base(builder)
{ }
public static UrlProviderResolver Current { get; }
= new UrlProviderResolver(CoreCurrent.Container.GetInstance<UrlProviderCollectionBuilder>());
public IEnumerable<IUrlProvider> Providers => WebCurrent.UrlProviders;
}
}

View File

@@ -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);
}
}

View File

@@ -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.

View File

@@ -181,7 +181,7 @@
<PackageReference Include="System.Xml.XPath" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath.XDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
<PackageReference Include="Umbraco.ModelsBuilder" Version="8.0.0-alpha.15" />
<PackageReference Include="Umbraco.ModelsBuilder" Version="8.0.0-alpha.17" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj">
@@ -751,11 +751,9 @@
<PropertyGroup>
<NuGetPackages>$(NuGetPackageFolders.Split(';')[0])</NuGetPackages>
</PropertyGroup>
<!-- import targets -->
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- web project -->
<ProjectExtensions>
<VisualStudio>
@@ -821,7 +819,6 @@
<Message Text="-AfterBuild-" Importance="high" />
<Message Text="Copy Web.$(Configuration).config.transformed over to Web.config (this is Visual Studio)" Importance="high" Condition="$(BuildingInsideVisualStudio) == true" />
<Copy SourceFiles="$(ProjectDir)Web.$(Configuration).config.transformed" DestinationFiles="$(ProjectDir)Web.config" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="false" Condition="$(BuildingInsideVisualStudio) == true" />
<Copy Condition="'$(BuildingInsideVisualStudio)' == 'true'" SourceFiles="$(ProjectDir)..\Umbraco.Compat7\bin\$(Configuration)\Umbraco.Compat7.dll" DestinationFolder="$(ProjectDir)bin" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="false" />
</Target>
<Target Name="BelleBuild">
<Exec WorkingDirectory="$(ProjectDir)\..\..\" Command="powershell -ExecutionPolicy RemoteSigned -Command &quot;&amp;{ $ubuild = &amp;&quot;$pwd\build\build.ps1&quot; -get ; $ubuild.CompileBelle() }&quot;" />

View File

@@ -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