diff --git a/src/Umbraco.Compat7/Compat7Component.cs b/src/Umbraco.Compat7/Compat7Component.cs index 457b8ec6f1..10ee481b16 100644 --- a/src/Umbraco.Compat7/Compat7Component.cs +++ b/src/Umbraco.Compat7/Compat7Component.cs @@ -18,8 +18,11 @@ namespace Umbraco.Compat7 public static event EventHandler ApplicationStarting; public static event EventHandler ApplicationStarted; - public override void Compose(ServiceContainer container) + public override void Compose(Composition composition) { + base.Compose(composition); + + var container = composition.Container; _app = container.GetInstance(); var logger = container.GetInstance(); diff --git a/src/Umbraco.Compat7/Core/ApplicationContext.cs b/src/Umbraco.Compat7/Core/ApplicationContext.cs index cbae589bab..6c0ab28b71 100644 --- a/src/Umbraco.Compat7/Core/ApplicationContext.cs +++ b/src/Umbraco.Compat7/Core/ApplicationContext.cs @@ -13,19 +13,19 @@ namespace Umbraco.Core public static ApplicationContext Current { get; } = new ApplicationContext(); - public CacheHelper ApplicationCache => DependencyInjection.Current.ApplicationCache; + public CacheHelper ApplicationCache => DI.Current.ApplicationCache; - public ProfilingLogger ProfilingLogger => DependencyInjection.Current.ProfilingLogger; + public ProfilingLogger ProfilingLogger => DI.Current.ProfilingLogger; public bool IsReady { get; } = true; // because... not accessible before we are ready - public bool IsConfigured => DependencyInjection.Current.RuntimeState.Level == RuntimeLevel.Run; + public bool IsConfigured => DI.Current.RuntimeState.Level == RuntimeLevel.Run; - public bool IsUpgrading => DependencyInjection.Current.RuntimeState.Level == RuntimeLevel.Upgrade; + public bool IsUpgrading => DI.Current.RuntimeState.Level == RuntimeLevel.Upgrade; - public DatabaseContext DatabaseContext => DependencyInjection.Current.DatabaseContext; + public DatabaseContext DatabaseContext => DI.Current.DatabaseContext; - public ServiceContext Services => DependencyInjection.Current.Services; + public ServiceContext Services => DI.Current.Services; public void Dispose() { } diff --git a/src/Umbraco.Compat7/Core/Cache/CacheRefreshersResolver.cs b/src/Umbraco.Compat7/Core/Cache/CacheRefreshersResolver.cs index 110dd848e6..5804ba0eee 100644 --- a/src/Umbraco.Compat7/Core/Cache/CacheRefreshersResolver.cs +++ b/src/Umbraco.Compat7/Core/Cache/CacheRefreshersResolver.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.Cache diff --git a/src/Umbraco.Compat7/Core/Dictionary/CultureDictionaryFactoryResolver.cs b/src/Umbraco.Compat7/Core/Dictionary/CultureDictionaryFactoryResolver.cs index 39c91af4fe..f88ef811f8 100644 --- a/src/Umbraco.Compat7/Core/Dictionary/CultureDictionaryFactoryResolver.cs +++ b/src/Umbraco.Compat7/Core/Dictionary/CultureDictionaryFactoryResolver.cs @@ -1,5 +1,5 @@ -using Umbraco.Core.DependencyInjection; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using Umbraco.Core.DI; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.Dictionary diff --git a/src/Umbraco.Compat7/Core/Logging/LoggerResolver.cs b/src/Umbraco.Compat7/Core/Logging/LoggerResolver.cs index c27f53daa6..aaa285f711 100644 --- a/src/Umbraco.Compat7/Core/Logging/LoggerResolver.cs +++ b/src/Umbraco.Compat7/Core/Logging/LoggerResolver.cs @@ -1,5 +1,5 @@ using System; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.Logging diff --git a/src/Umbraco.Compat7/Core/Logging/ProfilerResolver.cs b/src/Umbraco.Compat7/Core/Logging/ProfilerResolver.cs index bbe4d510be..b034c2c90e 100644 --- a/src/Umbraco.Compat7/Core/Logging/ProfilerResolver.cs +++ b/src/Umbraco.Compat7/Core/Logging/ProfilerResolver.cs @@ -1,5 +1,5 @@ using System; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.Logging diff --git a/src/Umbraco.Compat7/Core/Models/PublishedContent/PublishedContentModelFactoryResolver.cs b/src/Umbraco.Compat7/Core/Models/PublishedContent/PublishedContentModelFactoryResolver.cs index 03e034b8f1..7eeac98f52 100644 --- a/src/Umbraco.Compat7/Core/Models/PublishedContent/PublishedContentModelFactoryResolver.cs +++ b/src/Umbraco.Compat7/Core/Models/PublishedContent/PublishedContentModelFactoryResolver.cs @@ -1,5 +1,5 @@ -using Umbraco.Core.DependencyInjection; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using Umbraco.Core.DI; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.Models.PublishedContent diff --git a/src/Umbraco.Compat7/Core/ObjectResolution/LazyManyObjectsResolverBase.cs b/src/Umbraco.Compat7/Core/ObjectResolution/LazyManyObjectsResolverBase.cs index 2658aaf106..6a7dbf3fc3 100644 --- a/src/Umbraco.Compat7/Core/ObjectResolution/LazyManyObjectsResolverBase.cs +++ b/src/Umbraco.Compat7/Core/ObjectResolution/LazyManyObjectsResolverBase.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; // ReSharper disable once CheckNamespace namespace Umbraco.Core.ObjectResolution diff --git a/src/Umbraco.Compat7/Core/ObjectResolution/ManyObjectsResolverBase.cs b/src/Umbraco.Compat7/Core/ObjectResolution/ManyObjectsResolverBase.cs index a09fe0e0e8..233b59e95f 100644 --- a/src/Umbraco.Compat7/Core/ObjectResolution/ManyObjectsResolverBase.cs +++ b/src/Umbraco.Compat7/Core/ObjectResolution/ManyObjectsResolverBase.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; // ReSharper disable once CheckNamespace namespace Umbraco.Core.ObjectResolution diff --git a/src/Umbraco.Compat7/Core/ObjectResolution/WeightedObjectsResolverBase.cs b/src/Umbraco.Compat7/Core/ObjectResolution/WeightedObjectsResolverBase.cs index 8471c4d66d..d9496394be 100644 --- a/src/Umbraco.Compat7/Core/ObjectResolution/WeightedObjectsResolverBase.cs +++ b/src/Umbraco.Compat7/Core/ObjectResolution/WeightedObjectsResolverBase.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; // ReSharper disable once CheckNamespace namespace Umbraco.Core.ObjectResolution diff --git a/src/Umbraco.Compat7/Core/Persistence/Migrations/MigrationResolver.cs b/src/Umbraco.Compat7/Core/Persistence/Migrations/MigrationResolver.cs index 93c29d24f4..018f18e6b9 100644 --- a/src/Umbraco.Compat7/Core/Persistence/Migrations/MigrationResolver.cs +++ b/src/Umbraco.Compat7/Core/Persistence/Migrations/MigrationResolver.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.Persistence.Migrations diff --git a/src/Umbraco.Compat7/Core/PropertyEditors/PropertyEditorResolver.cs b/src/Umbraco.Compat7/Core/PropertyEditors/PropertyEditorResolver.cs index a842a4c6dc..c0a7210968 100644 --- a/src/Umbraco.Compat7/Core/PropertyEditors/PropertyEditorResolver.cs +++ b/src/Umbraco.Compat7/Core/PropertyEditors/PropertyEditorResolver.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.PropertyEditors diff --git a/src/Umbraco.Compat7/Core/PropertyEditors/PropertyValueConvertersResolver.cs b/src/Umbraco.Compat7/Core/PropertyEditors/PropertyValueConvertersResolver.cs index 333aa78ac3..06242d5234 100644 --- a/src/Umbraco.Compat7/Core/PropertyEditors/PropertyValueConvertersResolver.cs +++ b/src/Umbraco.Compat7/Core/PropertyEditors/PropertyValueConvertersResolver.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.PropertyEditors diff --git a/src/Umbraco.Compat7/Core/Strings/ShortStringHelperResolver.cs b/src/Umbraco.Compat7/Core/Strings/ShortStringHelperResolver.cs index 7e0444ab6c..e0fa6dfa46 100644 --- a/src/Umbraco.Compat7/Core/Strings/ShortStringHelperResolver.cs +++ b/src/Umbraco.Compat7/Core/Strings/ShortStringHelperResolver.cs @@ -1,5 +1,5 @@ -using Umbraco.Core.DependencyInjection; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using Umbraco.Core.DI; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.Strings diff --git a/src/Umbraco.Compat7/Core/Strings/UrlSegmentProviderResolver.cs b/src/Umbraco.Compat7/Core/Strings/UrlSegmentProviderResolver.cs index b44897463a..42a271fd74 100644 --- a/src/Umbraco.Compat7/Core/Strings/UrlSegmentProviderResolver.cs +++ b/src/Umbraco.Compat7/Core/Strings/UrlSegmentProviderResolver.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.Strings diff --git a/src/Umbraco.Compat7/Core/Sync/ServerMessengerResolver.cs b/src/Umbraco.Compat7/Core/Sync/ServerMessengerResolver.cs index 2bbb1b6a7a..69d3c055c1 100644 --- a/src/Umbraco.Compat7/Core/Sync/ServerMessengerResolver.cs +++ b/src/Umbraco.Compat7/Core/Sync/ServerMessengerResolver.cs @@ -1,5 +1,5 @@ -using Umbraco.Core.DependencyInjection; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using Umbraco.Core.DI; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.Sync diff --git a/src/Umbraco.Compat7/Core/Sync/ServerRegistrarResolver.cs b/src/Umbraco.Compat7/Core/Sync/ServerRegistrarResolver.cs index 0abc4a121f..18b331a0a0 100644 --- a/src/Umbraco.Compat7/Core/Sync/ServerRegistrarResolver.cs +++ b/src/Umbraco.Compat7/Core/Sync/ServerRegistrarResolver.cs @@ -1,5 +1,5 @@ -using Umbraco.Core.DependencyInjection; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using Umbraco.Core.DI; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Core.Sync diff --git a/src/Umbraco.Compat7/Web/HealthCheck/HealthCheckResolver.cs b/src/Umbraco.Compat7/Web/HealthCheck/HealthCheckResolver.cs index 8d2203eeed..8cec0a7b1c 100644 --- a/src/Umbraco.Compat7/Web/HealthCheck/HealthCheckResolver.cs +++ b/src/Umbraco.Compat7/Web/HealthCheck/HealthCheckResolver.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; // ReSharper disable once CheckNamespace namespace Umbraco.Web.HealthCheck diff --git a/src/Umbraco.Compat7/Web/Media/ThumbnailProvidersResolver.cs b/src/Umbraco.Compat7/Web/Media/ThumbnailProvidersResolver.cs index fb2c685f27..61119a7038 100644 --- a/src/Umbraco.Compat7/Web/Media/ThumbnailProvidersResolver.cs +++ b/src/Umbraco.Compat7/Web/Media/ThumbnailProvidersResolver.cs @@ -2,7 +2,7 @@ using Umbraco.Core.Media; using Umbraco.Core.ObjectResolution; using Umbraco.Web.Media.ThumbnailProviders; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; using WebCurrent = Umbraco.Web.Current; // ReSharper disable once CheckNamespace diff --git a/src/Umbraco.Compat7/Web/Mvc/FilteredControllerFactoriesResolver.cs b/src/Umbraco.Compat7/Web/Mvc/FilteredControllerFactoriesResolver.cs index 77d81e115e..28e01b85b5 100644 --- a/src/Umbraco.Compat7/Web/Mvc/FilteredControllerFactoriesResolver.cs +++ b/src/Umbraco.Compat7/Web/Mvc/FilteredControllerFactoriesResolver.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; using WebCurrent = Umbraco.Web.Current; // ReSharper disable once CheckNamespace diff --git a/src/Umbraco.Compat7/Web/Routing/ContentFinderResolver.cs b/src/Umbraco.Compat7/Web/Routing/ContentFinderResolver.cs index c6b3558bb5..aff430d615 100644 --- a/src/Umbraco.Compat7/Web/Routing/ContentFinderResolver.cs +++ b/src/Umbraco.Compat7/Web/Routing/ContentFinderResolver.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; using WebCurrent = Umbraco.Web.Current; // ReSharper disable once CheckNamespace diff --git a/src/Umbraco.Compat7/Web/Routing/ContentLastChangeFinderResolver.cs b/src/Umbraco.Compat7/Web/Routing/ContentLastChangeFinderResolver.cs index d9c66324c0..b7106e2e1d 100644 --- a/src/Umbraco.Compat7/Web/Routing/ContentLastChangeFinderResolver.cs +++ b/src/Umbraco.Compat7/Web/Routing/ContentLastChangeFinderResolver.cs @@ -1,6 +1,6 @@ using System; -using Umbraco.Core.DependencyInjection; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using Umbraco.Core.DI; +using CoreCurrent = Umbraco.Core.DI.Current; using WebCurrent = Umbraco.Web.Current; // ReSharper disable once CheckNamespace diff --git a/src/Umbraco.Compat7/Web/Routing/SiteDomainHelperResolver.cs b/src/Umbraco.Compat7/Web/Routing/SiteDomainHelperResolver.cs index 65a2637f5b..5e11f77e67 100644 --- a/src/Umbraco.Compat7/Web/Routing/SiteDomainHelperResolver.cs +++ b/src/Umbraco.Compat7/Web/Routing/SiteDomainHelperResolver.cs @@ -1,5 +1,5 @@ -using Umbraco.Core.DependencyInjection; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using Umbraco.Core.DI; +using CoreCurrent = Umbraco.Core.DI.Current; using WebCurrent = Umbraco.Web.Current; // ReSharper disable once CheckNamespace diff --git a/src/Umbraco.Compat7/Web/Routing/UrlProviderResolver.cs b/src/Umbraco.Compat7/Web/Routing/UrlProviderResolver.cs index d36609d3bb..f05976e53e 100644 --- a/src/Umbraco.Compat7/Web/Routing/UrlProviderResolver.cs +++ b/src/Umbraco.Compat7/Web/Routing/UrlProviderResolver.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Umbraco.Core.ObjectResolution; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; using WebCurrent = Umbraco.Web.Current; // ReSharper disable once CheckNamespace diff --git a/src/Umbraco.Core/Cache/CacheRefresherCollection.cs b/src/Umbraco.Core/Cache/CacheRefresherCollection.cs index aedce683b4..ae5b7ed4b2 100644 --- a/src/Umbraco.Core/Cache/CacheRefresherCollection.cs +++ b/src/Umbraco.Core/Cache/CacheRefresherCollection.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Cache { diff --git a/src/Umbraco.Core/Cache/CacheRefresherCollectionBuilder.cs b/src/Umbraco.Core/Cache/CacheRefresherCollectionBuilder.cs index 7ffa609cd6..a05b26c055 100644 --- a/src/Umbraco.Core/Cache/CacheRefresherCollectionBuilder.cs +++ b/src/Umbraco.Core/Cache/CacheRefresherCollectionBuilder.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Cache { diff --git a/src/Umbraco.Core/Components/BootLoader.cs b/src/Umbraco.Core/Components/BootLoader.cs index b28119cac1..f83575a01e 100644 --- a/src/Umbraco.Core/Components/BootLoader.cs +++ b/src/Umbraco.Core/Components/BootLoader.cs @@ -40,7 +40,7 @@ namespace Umbraco.Core.Components { if (_booted) throw new InvalidOperationException("Can not boot, has already booted."); - var orderedComponentTypes = PrepareComponentTypes(componentTypes); + var orderedComponentTypes = PrepareComponentTypes(componentTypes, level); InstanciateComponents(orderedComponentTypes); ComposeComponents(level); @@ -50,17 +50,24 @@ namespace Umbraco.Core.Components _booted = true; } - private IEnumerable PrepareComponentTypes(IEnumerable componentTypes) + private IEnumerable PrepareComponentTypes(IEnumerable componentTypes, RuntimeLevel level) { using (_proflog.DebugDuration("Preparing component types.", "Prepared component types.")) { - return PrepareComponentTypes2(componentTypes); + return PrepareComponentTypes2(componentTypes, level); } } - private static IEnumerable PrepareComponentTypes2(IEnumerable componentTypes) + private static IEnumerable PrepareComponentTypes2(IEnumerable componentTypes, RuntimeLevel level) { - var componentTypeList = componentTypes.ToList(); + // create a list, remove those that cannot be enabled due to runtime level + var componentTypeList = componentTypes + .Where(x => + { + var attr = x.GetCustomAttribute(); + return attr == null || level >= attr.MinLevel; + }) + .ToList(); // cannot remove that one - ever if (componentTypeList.Contains(typeof(UmbracoCoreComponent)) == false) @@ -176,12 +183,13 @@ namespace Umbraco.Core.Components { using (_proflog.DebugDuration($"Composing components. (log when >{LogThresholdMilliseconds}ms)", "Composed components.")) { + var composition = new Composition(_container, level); foreach (var component in _components) { var componentType = component.GetType(); using (_proflog.DebugDuration($"Composing {componentType.FullName}.", $"Composed {componentType.FullName}.", thresholdMilliseconds: LogThresholdMilliseconds)) { - component.Compose(_container, level); + component.Compose(composition); } } } diff --git a/src/Umbraco.Core/Components/Composition.cs b/src/Umbraco.Core/Components/Composition.cs new file mode 100644 index 0000000000..844b5b0267 --- /dev/null +++ b/src/Umbraco.Core/Components/Composition.cs @@ -0,0 +1,37 @@ +using LightInject; + +namespace Umbraco.Core.Components +{ + /// + /// Represents a composition. + /// + /// Although a composition exposes the application's service container, people should use the + /// extension methods (such as PropertyEditors() or SetPublishedContentModelFactory()) and + /// avoid accessing the container. This is because everything needs to be properly registered and with + /// the proper lifecycle. These methods will take care of it. Directly registering into the container + /// may cause issues. + public class Composition + { + /// + /// Initializes a new instance of the class. + /// + /// A container. + /// The runtime level. + public Composition(ServiceContainer container, RuntimeLevel level) + { + Container = container; + RuntimeLevel = level; + } + + /// + /// Gets the container. + /// + /// Use with care! + public ServiceContainer Container { get; } + + /// + /// Gets the runtime level. + /// + public RuntimeLevel RuntimeLevel { get; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Components/CompositionExtensions.cs b/src/Umbraco.Core/Components/CompositionExtensions.cs new file mode 100644 index 0000000000..1c47a47c64 --- /dev/null +++ b/src/Umbraco.Core/Components/CompositionExtensions.cs @@ -0,0 +1,248 @@ +using System; +using System.Runtime.CompilerServices; +using LightInject; +using Umbraco.Core.Cache; +using Umbraco.Core.Dictionary; +using Umbraco.Core.DI; +using Umbraco.Core.Models.PublishedContent; +using Umbraco.Core.Persistence.Mappers; +using Umbraco.Core.Persistence.Migrations; +using Umbraco.Core.PropertyEditors; +using Umbraco.Core.Strings; +using Umbraco.Core.Sync; +using Umbraco.Core._Legacy.PackageActions; + +namespace Umbraco.Core.Components +{ + /// + /// Provides extension methods to the class. + /// + public static class CompositionExtensions + { + #region Collection Builders + + /// + /// Gets the cache refreshers collection builder. + /// + /// The composition. + public static CacheRefresherCollectionBuilder CacheRefreshers(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the mappers collection builder. + /// + /// The composition. + public static MapperCollectionBuilder Mappers(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the migrations collection builder. + /// + /// The composition. + public static MigrationCollectionBuilder Migrations(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the package actions collection builder. + /// + /// The composition. + internal static PackageActionCollectionBuilder PackageActions(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the parameter editors collection builder. + /// + /// The composition. + internal static ParameterEditorCollectionBuilder ParameterEditors(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the migrations collection builder. + /// + /// The composition. + public static PropertyEditorCollectionBuilder PropertyEditors(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the property value converters collection builder. + /// + /// The composition. + public static PropertyValueConverterCollectionBuilder PropertyValueConverters(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the url segment providers collection builder. + /// + /// The composition. + public static UrlSegmentProviderCollectionBuilder UrlSegmentProviders(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the validators collection builder. + /// + /// The composition. + internal static ValidatorCollectionBuilder Validators(this Composition composition) + => composition.Container.GetInstance(); + + #endregion + + #region Singleton + + /// + /// Sets the culture dictionary factory. + /// + /// The type of the factory. + /// The composition. + public static void SetCultureDictionaryFactory(this Composition composition) + where T : ICultureDictionaryFactory + { + composition.Container.RegisterSingleton(); + } + + /// + /// Sets the culture dictionary factory. + /// + /// The composition. + /// A function creating a culture dictionary factory. + public static void SetCultureDictionaryFactory(this Composition composition, Func factory) + { + composition.Container.RegisterSingleton(factory); + } + + /// + /// Sets the culture dictionary factory. + /// + /// The composition. + /// A factory. + public static void SetCultureDictionaryFactory(this Composition composition, ICultureDictionaryFactory factory) + { + composition.Container.RegisterSingleton(_ => factory); + } + + /// + /// Sets the published content model factory. + /// + /// The type of the factory. + /// The composition. + public static void SetPublishedContentModelFactory(this Composition composition) + where T : IPublishedContentModelFactory + { + composition.Container.RegisterSingleton(); + } + + /// + /// Sets the published content model factory. + /// + /// The composition. + /// A function creating a published content model factory. + public static void SetPublishedContentModelFactory(this Composition composition, Func factory) + { + composition.Container.RegisterSingleton(factory); + } + + /// + /// Sets the published content model factory. + /// + /// The composition. + /// A published content model factory. + public static void SetPublishedContentModelFactory(this Composition composition, IPublishedContentModelFactory factory) + { + composition.Container.RegisterSingleton(_ => factory); + } + + /// + /// Sets the server registrar. + /// + /// The type of the server registrar. + /// The composition. + public static void SetServerRegistrar(this Composition composition) + where T : IServerRegistrar + { + composition.Container.RegisterSingleton(); + } + + /// + /// Sets the server registrar. + /// + /// The composition. + /// A function creating a server registar. + public static void SetServerRegistrar(this Composition composition, Func factory) + { + composition.Container.RegisterSingleton(factory); + } + + /// + /// Sets the server registrar. + /// + /// The composition. + /// A server registrar. + public static void SetServerRegistrar(this Composition composition, IServerRegistrar registrar) + { + composition.Container.RegisterSingleton(_ => registrar); + } + + /// + /// Sets the server messenger. + /// + /// The type of the server registrar. + /// The composition. + public static void SetServerMessenger(this Composition composition) + where T : IServerMessenger + { + composition.Container.RegisterSingleton(); + } + + /// + /// Sets the server messenger. + /// + /// The composition. + /// A function creating a server messenger. + public static void SetServerMessenger(this Composition composition, Func factory) + { + composition.Container.RegisterSingleton(factory); + } + + /// + /// Sets the server messenger. + /// + /// The composition. + /// A server messenger. + public static void SetServerMessenger(this Composition composition, IServerMessenger registrar) + { + composition.Container.RegisterSingleton(_ => registrar); + } + + /// + /// Sets the short string helper. + /// + /// The type of the short string helper. + /// The composition. + public static void SetShortStringHelper(this Composition composition) + where T : IShortStringHelper + { + composition.Container.RegisterSingleton(); + } + + /// + /// Sets the short string helper. + /// + /// The composition. + /// A function creating a short string helper. + public static void SetShortStringHelper(this Composition composition, Func factory) + { + composition.Container.RegisterSingleton(factory); + } + + /// + /// Sets the short string helper. + /// + /// A composition. + /// A short string helper. + public static void SetShortStringHelper(this Composition composition, IShortStringHelper helper) + { + composition.Container.RegisterSingleton(_ => helper); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Components/IUmbracoComponent.cs b/src/Umbraco.Core/Components/IUmbracoComponent.cs index 01e9e6fbf0..e54c7157ef 100644 --- a/src/Umbraco.Core/Components/IUmbracoComponent.cs +++ b/src/Umbraco.Core/Components/IUmbracoComponent.cs @@ -1,6 +1,4 @@ -using LightInject; - -namespace Umbraco.Core.Components +namespace Umbraco.Core.Components { /// /// Represents an Umbraco component. @@ -10,9 +8,8 @@ namespace Umbraco.Core.Components /// /// Composes the component. /// - /// The container. - /// The runtime level. - void Compose(ServiceContainer container, RuntimeLevel level); + /// The composition. + void Compose(Composition composition); /// /// Terminates the component. diff --git a/src/Umbraco.Core/Components/RuntimeLevelAttribute.cs b/src/Umbraco.Core/Components/RuntimeLevelAttribute.cs new file mode 100644 index 0000000000..51920660d4 --- /dev/null +++ b/src/Umbraco.Core/Components/RuntimeLevelAttribute.cs @@ -0,0 +1,13 @@ +using System; + +namespace Umbraco.Core.Components +{ + [AttributeUsage(AttributeTargets.Class /*, AllowMultiple = false, Inherited = true*/)] + public class RuntimeLevelAttribute : Attribute + { + //public RuntimeLevelAttribute() + //{ } + + public RuntimeLevel MinLevel { get; set; } = RuntimeLevel.Boot; + } +} diff --git a/src/Umbraco.Core/Components/UmbracoComponentBase.cs b/src/Umbraco.Core/Components/UmbracoComponentBase.cs index 7d67153b95..476c4c6d59 100644 --- a/src/Umbraco.Core/Components/UmbracoComponentBase.cs +++ b/src/Umbraco.Core/Components/UmbracoComponentBase.cs @@ -1,6 +1,4 @@ -using LightInject; - -namespace Umbraco.Core.Components +namespace Umbraco.Core.Components { /// /// Provides a base class for implementations. @@ -8,16 +6,7 @@ namespace Umbraco.Core.Components public abstract class UmbracoComponentBase : IUmbracoComponent { /// - public virtual void Compose(ServiceContainer container, RuntimeLevel level) - { - Compose(container); - } - - /// - /// Composes the component. - /// - /// The container. - public virtual void Compose(ServiceContainer container) + public virtual void Compose(Composition composition) { } /// diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index 068d1a574a..2f392c39e0 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -10,7 +10,7 @@ using System.Web.Security; using System.Xml; using System.Xml.Linq; using System.Xml.XPath; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Security; diff --git a/src/Umbraco.Core/Configuration/UmbracoConfig.cs b/src/Umbraco.Core/Configuration/UmbracoConfig.cs index 6ed27fe664..d0c873222d 100644 --- a/src/Umbraco.Core/Configuration/UmbracoConfig.cs +++ b/src/Umbraco.Core/Configuration/UmbracoConfig.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Cache; using Umbraco.Core.Configuration.Dashboard; using Umbraco.Core.Configuration.Grid; using Umbraco.Core.Configuration.UmbracoSettings; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Core.Configuration diff --git a/src/Umbraco.Core/CoreRuntime.cs b/src/Umbraco.Core/CoreRuntime.cs index b9e482ad0f..aa6679b8c9 100644 --- a/src/Umbraco.Core/CoreRuntime.cs +++ b/src/Umbraco.Core/CoreRuntime.cs @@ -7,7 +7,7 @@ using Semver; using Umbraco.Core.Cache; using Umbraco.Core.Components; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Exceptions; using Umbraco.Core.IO; using Umbraco.Core.Logging; @@ -201,7 +201,7 @@ namespace Umbraco.Core // register persistence mappers - means the only place the collection can be modified // is in a runtime - afterwards it has been frozen and it is too late - MapperCollectionBuilder.Register(container) + container.RegisterCollectionBuilder() .Add(f => f.GetInstance().ResolveAssignedMapperTypes()); // register database factory diff --git a/src/Umbraco.Core/CoreRuntimeComponent.cs b/src/Umbraco.Core/CoreRuntimeComponent.cs index 1ad75a02c6..63f442276e 100644 --- a/src/Umbraco.Core/CoreRuntimeComponent.cs +++ b/src/Umbraco.Core/CoreRuntimeComponent.cs @@ -7,7 +7,7 @@ using Umbraco.Core.Cache; using Umbraco.Core.Components; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Manifest; @@ -26,47 +26,35 @@ namespace Umbraco.Core { public class CoreRuntimeComponent : UmbracoComponentBase, IRuntimeComponent { - public override void Compose(ServiceContainer container) + public override void Compose(Composition composition) { - base.Compose(container); + base.Compose(composition); // register from roots - container.RegisterFrom(); - container.RegisterFrom(); - container.RegisterFrom(); - container.RegisterFrom(); - - - - - - - - - - - + composition.Container.RegisterFrom(); + composition.Container.RegisterFrom(); + composition.Container.RegisterFrom(); + composition.Container.RegisterFrom(); //TODO: Don't think we'll need this when the resolvers are all container resolvers - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); - container.Register(factory => FileSystemProviderManager.Current.GetFileSystemProvider()); - - // fixme - should we capture Logger, etc here or use factory? + composition.Container.Register(factory + => FileSystemProviderManager.Current.GetFileSystemProvider()); // register manifest builder, will be injected in eg PropertyEditorCollectionBuilder - container.RegisterSingleton(factory + composition.Container.RegisterSingleton(factory => new ManifestParser(factory.GetInstance(), new DirectoryInfo(IOHelper.MapPath("~/App_Plugins")), factory.GetInstance())); - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); - PropertyEditorCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Add(factory => factory.GetInstance().ResolvePropertyEditors()); - ParameterEditorCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Add(factory => factory.GetInstance().ResolveParameterEditors()); // register our predefined validators - ValidatorCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Add() .Add() .Add() @@ -76,17 +64,16 @@ namespace Umbraco.Core // register a server registrar, by default it's the db registrar unless the dev // has the legacy dist calls enabled - fixme - should obsolete the legacy thing - container.RegisterSingleton(factory => UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled + composition.Container.RegisterSingleton(factory => UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled ? (IServerRegistrar)new ConfigServerRegistrar(UmbracoConfig.For.UmbracoSettings()) : (IServerRegistrar)new DatabaseServerRegistrar( new Lazy(factory.GetInstance), new DatabaseServerRegistrarOptions())); // by default we'll use the database server messenger with default options (no callbacks), - // this will be overridden in the web startup - // fixme - painful, have to take care of lifetime! - we CANNOT ask users to remember! - // fixme - same issue with PublishedContentModelFactory and many more, I guess! - container.RegisterSingleton(factory + // this will be overridden by either the legacy thing or the db thing in the corresponding + // components in the web project - fixme - should obsolete the legacy thing + composition.Container.RegisterSingleton(factory => new DatabaseServerMessenger( factory.GetInstance(), factory.GetInstance(), @@ -94,27 +81,27 @@ namespace Umbraco.Core factory.GetInstance(), true, new DatabaseServerMessengerOptions())); - CacheRefresherCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Add(factory => factory.GetInstance().ResolveCacheRefreshers()); - PackageActionCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Add(f => f.GetInstance().ResolvePackageActions()); - MigrationCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Add(factory => factory.GetInstance().ResolveTypes()); // need to filter out the ones we dont want!! fixme - what does that mean? - PropertyValueConverterCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Append(factory => factory.GetInstance().ResolveTypes()); - container.RegisterSingleton(factory + composition.Container.RegisterSingleton(factory => new DefaultShortStringHelper(new DefaultShortStringHelperConfig().WithDefault(factory.GetInstance()))); - UrlSegmentProviderCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Append(); // by default, register a noop factory - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); } internal void Initialize( diff --git a/src/Umbraco.Core/DependencyInjection/BuilderCollectionBase.cs b/src/Umbraco.Core/DI/BuilderCollectionBase.cs similarity index 96% rename from src/Umbraco.Core/DependencyInjection/BuilderCollectionBase.cs rename to src/Umbraco.Core/DI/BuilderCollectionBase.cs index 673fbf4ebc..2089da0bdc 100644 --- a/src/Umbraco.Core/DependencyInjection/BuilderCollectionBase.cs +++ b/src/Umbraco.Core/DI/BuilderCollectionBase.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { /// /// Provides a base class for builder collections. diff --git a/src/Umbraco.Core/DependencyInjection/CollectionBuilderBase.cs b/src/Umbraco.Core/DI/CollectionBuilderBase.cs similarity index 85% rename from src/Umbraco.Core/DependencyInjection/CollectionBuilderBase.cs rename to src/Umbraco.Core/DI/CollectionBuilderBase.cs index bfcdb6c2c7..3a0e3124d4 100644 --- a/src/Umbraco.Core/DependencyInjection/CollectionBuilderBase.cs +++ b/src/Umbraco.Core/DI/CollectionBuilderBase.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Linq.Expressions; using LightInject; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { /// /// Provides a base class for collection builders. @@ -70,34 +70,6 @@ namespace Umbraco.Core.DependencyInjection /// Return null for transient collections. protected virtual ILifetime CollectionLifetime => new PerContainerLifetime(); - /// - /// Registers the collection builder into a service container. - /// - /// The service container. - /// The collection builder is registered with a "per container" lifetime, - /// and the collection is registered wiht a lifetime that is "per container" by - /// default but can be overriden by each builder implementation. - public static TBuilder Register(IServiceContainer container) - { - // register the builder - per container - var builderLifetime = new PerContainerLifetime(); - container.Register(builderLifetime); - - // return the builder - // also initializes the builder - return container.GetInstance(); - } - - /// - /// Gets the collection builder from a service container. - /// - /// The service container. - /// The collection builder. - public static TBuilder Get(IServiceContainer container) - { - return container.GetInstance(); - } - /// /// Configures the internal list of types. /// diff --git a/src/Umbraco.Core/DependencyInjection/ConfigurationCompositionRoot.cs b/src/Umbraco.Core/DI/ConfigurationCompositionRoot.cs similarity index 95% rename from src/Umbraco.Core/DependencyInjection/ConfigurationCompositionRoot.cs rename to src/Umbraco.Core/DI/ConfigurationCompositionRoot.cs index df38fbfbb4..335c8ed573 100644 --- a/src/Umbraco.Core/DependencyInjection/ConfigurationCompositionRoot.cs +++ b/src/Umbraco.Core/DI/ConfigurationCompositionRoot.cs @@ -2,7 +2,7 @@ using LightInject; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { /// /// Sets up IoC container for Umbraco configuration classes diff --git a/src/Umbraco.Core/DependencyInjection/CoreModelMappersCompositionRoot.cs b/src/Umbraco.Core/DI/CoreModelMappersCompositionRoot.cs similarity index 86% rename from src/Umbraco.Core/DependencyInjection/CoreModelMappersCompositionRoot.cs rename to src/Umbraco.Core/DI/CoreModelMappersCompositionRoot.cs index ae5a215521..41b1834567 100644 --- a/src/Umbraco.Core/DependencyInjection/CoreModelMappersCompositionRoot.cs +++ b/src/Umbraco.Core/DI/CoreModelMappersCompositionRoot.cs @@ -1,7 +1,7 @@ using LightInject; using Umbraco.Core.Models.Identity; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { public sealed class CoreModelMappersCompositionRoot : ICompositionRoot { diff --git a/src/Umbraco.Core/DependencyInjection/Current.cs b/src/Umbraco.Core/DI/Current.cs similarity index 99% rename from src/Umbraco.Core/DependencyInjection/Current.cs rename to src/Umbraco.Core/DI/Current.cs index 3f83d33291..00a1b5c784 100644 --- a/src/Umbraco.Core/DependencyInjection/Current.cs +++ b/src/Umbraco.Core/DI/Current.cs @@ -12,7 +12,7 @@ using Umbraco.Core.Strings; using Umbraco.Core.Sync; using Umbraco.Core._Legacy.PackageActions; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { // this class is here to support the transition from singletons and resolvers to injection, // by providing a static access to singleton services - it is initialized once with a service diff --git a/src/Umbraco.Core/DependencyInjection/IBuilderCollection.cs b/src/Umbraco.Core/DI/IBuilderCollection.cs similarity index 91% rename from src/Umbraco.Core/DependencyInjection/IBuilderCollection.cs rename to src/Umbraco.Core/DI/IBuilderCollection.cs index ebb73f004c..0326082c6f 100644 --- a/src/Umbraco.Core/DependencyInjection/IBuilderCollection.cs +++ b/src/Umbraco.Core/DI/IBuilderCollection.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { /// /// Represents a builder collection, ie an immutable enumeration of items. diff --git a/src/Umbraco.Core/DependencyInjection/ICollectionBuilder.cs b/src/Umbraco.Core/DI/ICollectionBuilder.cs similarity index 93% rename from src/Umbraco.Core/DependencyInjection/ICollectionBuilder.cs rename to src/Umbraco.Core/DI/ICollectionBuilder.cs index da456b3094..7813cb7f84 100644 --- a/src/Umbraco.Core/DependencyInjection/ICollectionBuilder.cs +++ b/src/Umbraco.Core/DI/ICollectionBuilder.cs @@ -1,4 +1,4 @@ -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { /// /// Represents a collection builder. diff --git a/src/Umbraco.Core/DependencyInjection/LazyCollectionBuilderBase.cs b/src/Umbraco.Core/DI/LazyCollectionBuilderBase.cs similarity index 99% rename from src/Umbraco.Core/DependencyInjection/LazyCollectionBuilderBase.cs rename to src/Umbraco.Core/DI/LazyCollectionBuilderBase.cs index 6a4fc7a798..764a179f37 100644 --- a/src/Umbraco.Core/DependencyInjection/LazyCollectionBuilderBase.cs +++ b/src/Umbraco.Core/DI/LazyCollectionBuilderBase.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using LightInject; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { /// /// Implements a lazy collection builder. diff --git a/src/Umbraco.Core/DependencyInjection/LightInjectExtensions.cs b/src/Umbraco.Core/DI/LightInjectExtensions.cs similarity index 96% rename from src/Umbraco.Core/DependencyInjection/LightInjectExtensions.cs rename to src/Umbraco.Core/DI/LightInjectExtensions.cs index 5ce859ae74..bfd51316f3 100644 --- a/src/Umbraco.Core/DependencyInjection/LightInjectExtensions.cs +++ b/src/Umbraco.Core/DI/LightInjectExtensions.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using LightInject; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { internal static class LightInjectExtensions { @@ -249,5 +249,16 @@ namespace Umbraco.Core.DependencyInjection return false; }, null); } + + public static TBuilder RegisterCollectionBuilder(this IServiceContainer container) + { + // register the builder - per container + var builderLifetime = new PerContainerLifetime(); + container.Register(builderLifetime); + + // return the builder + // (also initializes the builder) + return container.GetInstance(); + } } } diff --git a/src/Umbraco.Core/DependencyInjection/MixedScopeManagerProvider.cs b/src/Umbraco.Core/DI/MixedScopeManagerProvider.cs similarity index 97% rename from src/Umbraco.Core/DependencyInjection/MixedScopeManagerProvider.cs rename to src/Umbraco.Core/DI/MixedScopeManagerProvider.cs index c5321286b1..4bfec9dd1a 100644 --- a/src/Umbraco.Core/DependencyInjection/MixedScopeManagerProvider.cs +++ b/src/Umbraco.Core/DI/MixedScopeManagerProvider.cs @@ -1,7 +1,7 @@ using LightInject; using LightInject.Web; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { // by default, the container's scope manager provider is PerThreadScopeManagerProvider, // and then container.EnablePerWebRequestScope() replaces it with PerWebRequestScopeManagerProvider, diff --git a/src/Umbraco.Core/DependencyInjection/OrderedCollectionBuilderBase.cs b/src/Umbraco.Core/DI/OrderedCollectionBuilderBase.cs similarity index 99% rename from src/Umbraco.Core/DependencyInjection/OrderedCollectionBuilderBase.cs rename to src/Umbraco.Core/DI/OrderedCollectionBuilderBase.cs index 3960ff3cf7..1ae3ed1363 100644 --- a/src/Umbraco.Core/DependencyInjection/OrderedCollectionBuilderBase.cs +++ b/src/Umbraco.Core/DI/OrderedCollectionBuilderBase.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using LightInject; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { /// /// Implements an ordered collection builder. diff --git a/src/Umbraco.Core/DependencyInjection/RepositoryCompositionRoot.cs b/src/Umbraco.Core/DI/RepositoryCompositionRoot.cs similarity index 99% rename from src/Umbraco.Core/DependencyInjection/RepositoryCompositionRoot.cs rename to src/Umbraco.Core/DI/RepositoryCompositionRoot.cs index 02f0b6d6d1..070ea2605f 100644 --- a/src/Umbraco.Core/DependencyInjection/RepositoryCompositionRoot.cs +++ b/src/Umbraco.Core/DI/RepositoryCompositionRoot.cs @@ -9,7 +9,7 @@ using Umbraco.Core.Persistence.SqlSyntax; using Umbraco.Core.Persistence.UnitOfWork; using Umbraco.Core.Plugins; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { /// /// Sets the IoC container for the umbraco data layer/repositories/sql/database/etc... diff --git a/src/Umbraco.Core/DependencyInjection/ServicesCompositionRoot.cs b/src/Umbraco.Core/DI/ServicesCompositionRoot.cs similarity index 99% rename from src/Umbraco.Core/DependencyInjection/ServicesCompositionRoot.cs rename to src/Umbraco.Core/DI/ServicesCompositionRoot.cs index 4d185c4c41..a1d0cae9ad 100644 --- a/src/Umbraco.Core/DependencyInjection/ServicesCompositionRoot.cs +++ b/src/Umbraco.Core/DI/ServicesCompositionRoot.cs @@ -8,7 +8,7 @@ using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Services; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { public sealed class ServicesCompositionRoot : ICompositionRoot { diff --git a/src/Umbraco.Core/DependencyInjection/WeightAttribute.cs b/src/Umbraco.Core/DI/WeightAttribute.cs similarity index 93% rename from src/Umbraco.Core/DependencyInjection/WeightAttribute.cs rename to src/Umbraco.Core/DI/WeightAttribute.cs index 3dfbc5b5a7..adf6bec76a 100644 --- a/src/Umbraco.Core/DependencyInjection/WeightAttribute.cs +++ b/src/Umbraco.Core/DI/WeightAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { /// /// Specifies the weight of pretty much anything. diff --git a/src/Umbraco.Core/DependencyInjection/WeightedCollectionBuilderBase.cs b/src/Umbraco.Core/DI/WeightedCollectionBuilderBase.cs similarity index 98% rename from src/Umbraco.Core/DependencyInjection/WeightedCollectionBuilderBase.cs rename to src/Umbraco.Core/DI/WeightedCollectionBuilderBase.cs index eb922c9692..53287bb988 100644 --- a/src/Umbraco.Core/DependencyInjection/WeightedCollectionBuilderBase.cs +++ b/src/Umbraco.Core/DI/WeightedCollectionBuilderBase.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using LightInject; -namespace Umbraco.Core.DependencyInjection +namespace Umbraco.Core.DI { /// /// Implements a weighted collection builder. diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index 617c8a563e..687e9b6af3 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -9,7 +9,7 @@ using System.Xml.Linq; using NPoco; using Semver; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; diff --git a/src/Umbraco.Core/IO/PhysicalFileSystem.cs b/src/Umbraco.Core/IO/PhysicalFileSystem.cs index 1e02c93b24..29a0a84dac 100644 --- a/src/Umbraco.Core/IO/PhysicalFileSystem.cs +++ b/src/Umbraco.Core/IO/PhysicalFileSystem.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Core.IO diff --git a/src/Umbraco.Core/IO/UmbracoMediaFile.cs b/src/Umbraco.Core/IO/UmbracoMediaFile.cs index d427b76010..83942f339d 100644 --- a/src/Umbraco.Core/IO/UmbracoMediaFile.cs +++ b/src/Umbraco.Core/IO/UmbracoMediaFile.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Threading.Tasks; using System.Web; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Media; diff --git a/src/Umbraco.Core/Logging/ImageProcessorLogger.cs b/src/Umbraco.Core/Logging/ImageProcessorLogger.cs index 52d9b21f60..b1551395b4 100644 --- a/src/Umbraco.Core/Logging/ImageProcessorLogger.cs +++ b/src/Umbraco.Core/Logging/ImageProcessorLogger.cs @@ -1,4 +1,4 @@ -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Logging { diff --git a/src/Umbraco.Core/Logging/OwinLoggerFactory.cs b/src/Umbraco.Core/Logging/OwinLoggerFactory.cs index 101efd4a16..bceefa429c 100644 --- a/src/Umbraco.Core/Logging/OwinLoggerFactory.cs +++ b/src/Umbraco.Core/Logging/OwinLoggerFactory.cs @@ -1,6 +1,6 @@ using System; using Microsoft.Owin.Logging; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Logging { diff --git a/src/Umbraco.Core/Logging/WebProfilerComponent.cs b/src/Umbraco.Core/Logging/WebProfilerComponent.cs index b324a36354..9d779356f6 100644 --- a/src/Umbraco.Core/Logging/WebProfilerComponent.cs +++ b/src/Umbraco.Core/Logging/WebProfilerComponent.cs @@ -10,9 +10,9 @@ namespace Umbraco.Core.Logging // it is composed first thing in WebRuntime.Compose - this component // only initializes it if needed. // - //public override void Compose(ServiceContainer container) + //public override void Compose(Composition Composition) //{ - // container.RegisterSingleton(); + // composition.Container.RegisterSingleton(); //} private WebProfiler _profiler; diff --git a/src/Umbraco.Core/Macros/XsltExtensionCollection.cs b/src/Umbraco.Core/Macros/XsltExtensionCollection.cs index fc880f3f82..ecfad76619 100644 --- a/src/Umbraco.Core/Macros/XsltExtensionCollection.cs +++ b/src/Umbraco.Core/Macros/XsltExtensionCollection.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Macros { diff --git a/src/Umbraco.Core/Macros/XsltExtensionCollectionBuilder.cs b/src/Umbraco.Core/Macros/XsltExtensionCollectionBuilder.cs index aa4085a432..7df9a2d462 100644 --- a/src/Umbraco.Core/Macros/XsltExtensionCollectionBuilder.cs +++ b/src/Umbraco.Core/Macros/XsltExtensionCollectionBuilder.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Macros { diff --git a/src/Umbraco.Core/Models/ContentExtensions.cs b/src/Umbraco.Core/Models/ContentExtensions.cs index be8deeb8f9..feff196a41 100644 --- a/src/Umbraco.Core/Models/ContentExtensions.cs +++ b/src/Umbraco.Core/Models/ContentExtensions.cs @@ -11,7 +11,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Media; using Umbraco.Core.Models.EntityBase; diff --git a/src/Umbraco.Core/Models/Member.cs b/src/Umbraco.Core/Models/Member.cs index 3e9268f6aa..6502919588 100644 --- a/src/Umbraco.Core/Models/Member.cs +++ b/src/Umbraco.Core/Models/Member.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.Serialization; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Core.Models diff --git a/src/Umbraco.Core/Models/Membership/MembershipUserExtensions.cs b/src/Umbraco.Core/Models/Membership/MembershipUserExtensions.cs index 943be94c84..8010f464b1 100644 --- a/src/Umbraco.Core/Models/Membership/MembershipUserExtensions.cs +++ b/src/Umbraco.Core/Models/Membership/MembershipUserExtensions.cs @@ -1,6 +1,6 @@ using System; using System.Web.Security; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Security; using Umbraco.Core.Services; diff --git a/src/Umbraco.Core/Models/PropertyExtensions.cs b/src/Umbraco.Core/Models/PropertyExtensions.cs index 65f91d201f..37126213e0 100644 --- a/src/Umbraco.Core/Models/PropertyExtensions.cs +++ b/src/Umbraco.Core/Models/PropertyExtensions.cs @@ -2,7 +2,7 @@ using System.Xml; using System.Xml.Linq; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.PropertyEditors; using Umbraco.Core.Services; diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtensionsForModels.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtensionsForModels.cs index 012f0ada5c..6cc3eb638b 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtensionsForModels.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtensionsForModels.cs @@ -1,5 +1,5 @@ using System; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Models.PublishedContent { diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs index 867b318e6e..c1766ffd03 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Linq; using System.Xml.Linq; using System.Xml.XPath; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.PropertyEditors; using Umbraco.Core.Xml; diff --git a/src/Umbraco.Core/Packaging/PackageBinaryInspector.cs b/src/Umbraco.Core/Packaging/PackageBinaryInspector.cs index e4da91d257..110f6d2420 100644 --- a/src/Umbraco.Core/Packaging/PackageBinaryInspector.cs +++ b/src/Umbraco.Core/Packaging/PackageBinaryInspector.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Reflection; using System.Security; using System.Security.Permissions; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Core.Packaging diff --git a/src/Umbraco.Core/Persistence/DbConnectionExtensions.cs b/src/Umbraco.Core/Persistence/DbConnectionExtensions.cs index a0c42c5631..3fb6c8eaf3 100644 --- a/src/Umbraco.Core/Persistence/DbConnectionExtensions.cs +++ b/src/Umbraco.Core/Persistence/DbConnectionExtensions.cs @@ -3,7 +3,7 @@ using System.Data; using System.Data.Common; using System.Linq; using NPoco; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Core.Persistence diff --git a/src/Umbraco.Core/Persistence/Mappers/IMapperCollection.cs b/src/Umbraco.Core/Persistence/Mappers/IMapperCollection.cs index ba80ae053c..3f6c2c6cac 100644 --- a/src/Umbraco.Core/Persistence/Mappers/IMapperCollection.cs +++ b/src/Umbraco.Core/Persistence/Mappers/IMapperCollection.cs @@ -1,5 +1,5 @@ using System; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Persistence.Mappers { diff --git a/src/Umbraco.Core/Persistence/Mappers/MapperCollection.cs b/src/Umbraco.Core/Persistence/Mappers/MapperCollection.cs index 7718849562..bc10fc4758 100644 --- a/src/Umbraco.Core/Persistence/Mappers/MapperCollection.cs +++ b/src/Umbraco.Core/Persistence/Mappers/MapperCollection.cs @@ -2,7 +2,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Persistence.Mappers { diff --git a/src/Umbraco.Core/Persistence/Mappers/MapperCollectionBuilder.cs b/src/Umbraco.Core/Persistence/Mappers/MapperCollectionBuilder.cs index f7f3b72781..deed358190 100644 --- a/src/Umbraco.Core/Persistence/Mappers/MapperCollectionBuilder.cs +++ b/src/Umbraco.Core/Persistence/Mappers/MapperCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Persistence.Mappers { diff --git a/src/Umbraco.Core/Persistence/Migrations/MigrationCollection.cs b/src/Umbraco.Core/Persistence/Migrations/MigrationCollection.cs index 910eb62628..af6b56385a 100644 --- a/src/Umbraco.Core/Persistence/Migrations/MigrationCollection.cs +++ b/src/Umbraco.Core/Persistence/Migrations/MigrationCollection.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Persistence.Migrations { diff --git a/src/Umbraco.Core/Persistence/Migrations/MigrationCollectionBuilder.cs b/src/Umbraco.Core/Persistence/Migrations/MigrationCollectionBuilder.cs index ef97bd04c0..0c9164fab8 100644 --- a/src/Umbraco.Core/Persistence/Migrations/MigrationCollectionBuilder.cs +++ b/src/Umbraco.Core/Persistence/Migrations/MigrationCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Persistence.Migrations { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs index 44dd2c34f9..d4616ea199 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs @@ -1,6 +1,6 @@ using System; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Persistence.SqlSyntax; using Umbraco.Core.PropertyEditors; diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateAndRemoveTemplateMasterColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateAndRemoveTemplateMasterColumn.cs index c81267b3d4..c4ea9016c7 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateAndRemoveTemplateMasterColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateAndRemoveTemplateMasterColumn.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using NPoco; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models.Rdbms; using Umbraco.Core.Persistence.DatabaseModelDefinitions; diff --git a/src/Umbraco.Core/Persistence/Repositories/AuditRepository.cs b/src/Umbraco.Core/Persistence/Repositories/AuditRepository.cs index 0c6d61c68e..074374ae18 100644 --- a/src/Umbraco.Core/Persistence/Repositories/AuditRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/AuditRepository.cs @@ -4,7 +4,7 @@ using System.Linq; using LightInject; using NPoco; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.Rdbms; diff --git a/src/Umbraco.Core/Persistence/Repositories/MigrationEntryRepository.cs b/src/Umbraco.Core/Persistence/Repositories/MigrationEntryRepository.cs index 281c752732..baf6a0647a 100644 --- a/src/Umbraco.Core/Persistence/Repositories/MigrationEntryRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/MigrationEntryRepository.cs @@ -5,7 +5,7 @@ using LightInject; using NPoco; using Semver; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.Rdbms; diff --git a/src/Umbraco.Core/Persistence/Repositories/RelationRepository.cs b/src/Umbraco.Core/Persistence/Repositories/RelationRepository.cs index f0ef4e5f0e..ca9d25a22c 100644 --- a/src/Umbraco.Core/Persistence/Repositories/RelationRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/RelationRepository.cs @@ -4,7 +4,7 @@ using System.Linq; using LightInject; using NPoco; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.EntityBase; diff --git a/src/Umbraco.Core/Persistence/Repositories/RelationTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/RelationTypeRepository.cs index d328853509..bb73488397 100644 --- a/src/Umbraco.Core/Persistence/Repositories/RelationTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/RelationTypeRepository.cs @@ -4,7 +4,7 @@ using System.Linq; using LightInject; using NPoco; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.EntityBase; diff --git a/src/Umbraco.Core/Persistence/Repositories/TaskRepository.cs b/src/Umbraco.Core/Persistence/Repositories/TaskRepository.cs index 10df863bff..913c04c3e6 100644 --- a/src/Umbraco.Core/Persistence/Repositories/TaskRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/TaskRepository.cs @@ -5,7 +5,7 @@ using AutoMapper; using LightInject; using NPoco; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.EntityBase; diff --git a/src/Umbraco.Core/Persistence/Repositories/TaskTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/TaskTypeRepository.cs index 1542c3f3c7..18e659cb49 100644 --- a/src/Umbraco.Core/Persistence/Repositories/TaskTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/TaskTypeRepository.cs @@ -4,7 +4,7 @@ using System.Linq; using LightInject; using NPoco; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.Rdbms; diff --git a/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs index 46f9cc4b0b..699078d174 100644 --- a/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using NPoco; using Umbraco.Core.Cache; using Umbraco.Core.Configuration.UmbracoSettings; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Events; using Umbraco.Core.Logging; using Umbraco.Core.Models; diff --git a/src/Umbraco.Core/Plugins/TypeFinder.cs b/src/Umbraco.Core/Plugins/TypeFinder.cs index 265f69967b..677a8dd4d7 100644 --- a/src/Umbraco.Core/Plugins/TypeFinder.cs +++ b/src/Umbraco.Core/Plugins/TypeFinder.cs @@ -7,7 +7,7 @@ using System.Security; using System.Text; using System.Web; using System.Web.Compilation; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; diff --git a/src/Umbraco.Core/PropertyEditors/LegacyPropertyEditorIdToAliasConverter.cs b/src/Umbraco.Core/PropertyEditors/LegacyPropertyEditorIdToAliasConverter.cs index 3c5fe9e0c9..14f678274b 100644 --- a/src/Umbraco.Core/PropertyEditors/LegacyPropertyEditorIdToAliasConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/LegacyPropertyEditorIdToAliasConverter.cs @@ -3,7 +3,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Data; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Core.PropertyEditors diff --git a/src/Umbraco.Core/PropertyEditors/ManifestPropertyValidator.cs b/src/Umbraco.Core/PropertyEditors/ManifestPropertyValidator.cs index 6249b470fc..62587781b1 100644 --- a/src/Umbraco.Core/PropertyEditors/ManifestPropertyValidator.cs +++ b/src/Umbraco.Core/PropertyEditors/ManifestPropertyValidator.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Newtonsoft.Json; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models; using Umbraco.Core.Serialization; diff --git a/src/Umbraco.Core/PropertyEditors/ParameterEditorCollection.cs b/src/Umbraco.Core/PropertyEditors/ParameterEditorCollection.cs index 8593b8509c..cc0bdbfe41 100644 --- a/src/Umbraco.Core/PropertyEditors/ParameterEditorCollection.cs +++ b/src/Umbraco.Core/PropertyEditors/ParameterEditorCollection.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.PropertyEditors { diff --git a/src/Umbraco.Core/PropertyEditors/ParameterEditorCollectionBuilder.cs b/src/Umbraco.Core/PropertyEditors/ParameterEditorCollectionBuilder.cs index 6e6e2f97f2..efe6fa82f1 100644 --- a/src/Umbraco.Core/PropertyEditors/ParameterEditorCollectionBuilder.cs +++ b/src/Umbraco.Core/PropertyEditors/ParameterEditorCollectionBuilder.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Manifest; namespace Umbraco.Core.PropertyEditors diff --git a/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs b/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs index dbf71a3190..00c2653651 100644 --- a/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using Newtonsoft.Json; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Models; diff --git a/src/Umbraco.Core/PropertyEditors/PropertyEditorCollection.cs b/src/Umbraco.Core/PropertyEditors/PropertyEditorCollection.cs index d7884d109d..1062c9044b 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyEditorCollection.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyEditorCollection.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.PropertyEditors { diff --git a/src/Umbraco.Core/PropertyEditors/PropertyEditorCollectionBuilder.cs b/src/Umbraco.Core/PropertyEditors/PropertyEditorCollectionBuilder.cs index 3b87f8695f..f6617a5619 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyEditorCollectionBuilder.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyEditorCollectionBuilder.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Manifest; namespace Umbraco.Core.PropertyEditors diff --git a/src/Umbraco.Core/PropertyEditors/PropertyValueConverterCollection.cs b/src/Umbraco.Core/PropertyEditors/PropertyValueConverterCollection.cs index 8639926119..1f5c8fe029 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyValueConverterCollection.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyValueConverterCollection.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.PropertyEditors { diff --git a/src/Umbraco.Core/PropertyEditors/PropertyValueConverterCollectionBuilder.cs b/src/Umbraco.Core/PropertyEditors/PropertyValueConverterCollectionBuilder.cs index 51fd8e178d..d61ca26a74 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyValueConverterCollectionBuilder.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyValueConverterCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.PropertyEditors { diff --git a/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs b/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs index eb0217ff51..d1c35f0953 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs @@ -4,7 +4,7 @@ using System.Globalization; using System.Linq; using System.Xml.Linq; using Newtonsoft.Json; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Manifest; using Umbraco.Core.Models; diff --git a/src/Umbraco.Core/PropertyEditors/ValidatorCollection.cs b/src/Umbraco.Core/PropertyEditors/ValidatorCollection.cs index d9be27ee42..bc7eb03cbc 100644 --- a/src/Umbraco.Core/PropertyEditors/ValidatorCollection.cs +++ b/src/Umbraco.Core/PropertyEditors/ValidatorCollection.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.PropertyEditors { diff --git a/src/Umbraco.Core/PropertyEditors/ValidatorCollectionBuilder.cs b/src/Umbraco.Core/PropertyEditors/ValidatorCollectionBuilder.cs index e41bed4f06..71fb6dd0a9 100644 --- a/src/Umbraco.Core/PropertyEditors/ValidatorCollectionBuilder.cs +++ b/src/Umbraco.Core/PropertyEditors/ValidatorCollectionBuilder.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.PropertyEditors { diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs index 22c699c223..42685359e6 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs @@ -6,7 +6,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.Grid; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Models.PublishedContent; diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs index 5a422f80dc..176dbc3915 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.Services; diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs index 4ca8c91531..032abb9ffe 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs @@ -1,7 +1,7 @@ using System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models.PublishedContent; diff --git a/src/Umbraco.Core/Security/AuthenticationExtensions.cs b/src/Umbraco.Core/Security/AuthenticationExtensions.cs index 3761b1fadf..99010c85ee 100644 --- a/src/Umbraco.Core/Security/AuthenticationExtensions.cs +++ b/src/Umbraco.Core/Security/AuthenticationExtensions.cs @@ -15,7 +15,7 @@ using AutoMapper; using Microsoft.Owin; using Newtonsoft.Json; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; using Umbraco.Core.Logging; diff --git a/src/Umbraco.Core/Security/MembershipProviderBase.cs b/src/Umbraco.Core/Security/MembershipProviderBase.cs index 5c7b661b38..edb4680ff8 100644 --- a/src/Umbraco.Core/Security/MembershipProviderBase.cs +++ b/src/Umbraco.Core/Security/MembershipProviderBase.cs @@ -8,7 +8,7 @@ using System.Web; using System.Web.Configuration; using System.Web.Hosting; using System.Web.Security; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Core.Security diff --git a/src/Umbraco.Core/Services/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/EntityXmlSerializer.cs index b4fb2b843e..bf951ef9fa 100644 --- a/src/Umbraco.Core/Services/EntityXmlSerializer.cs +++ b/src/Umbraco.Core/Services/EntityXmlSerializer.cs @@ -6,7 +6,7 @@ using System.Web; using System.Xml; using System.Xml.Linq; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models; using Umbraco.Core.Persistence.Repositories; using Umbraco.Core.PropertyEditors; diff --git a/src/Umbraco.Core/Services/LocalizedTextServiceExtensions.cs b/src/Umbraco.Core/Services/LocalizedTextServiceExtensions.cs index 185d1f217d..c23df091d4 100644 --- a/src/Umbraco.Core/Services/LocalizedTextServiceExtensions.cs +++ b/src/Umbraco.Core/Services/LocalizedTextServiceExtensions.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Linq; using System.Threading; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Dictionary; namespace Umbraco.Core.Services diff --git a/src/Umbraco.Core/Services/LocalizedTextServiceFileSources.cs b/src/Umbraco.Core/Services/LocalizedTextServiceFileSources.cs index d02d6ad8c4..3ab72ce6b1 100644 --- a/src/Umbraco.Core/Services/LocalizedTextServiceFileSources.cs +++ b/src/Umbraco.Core/Services/LocalizedTextServiceFileSources.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Xml; using System.Xml.Linq; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Core.Services diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index 9eacaa792f..692813a0df 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -9,7 +9,7 @@ using System.Xml.Linq; using System.Xml.XPath; using Newtonsoft.Json; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Events; using Umbraco.Core.IO; using Umbraco.Core.Logging; diff --git a/src/Umbraco.Core/Services/TagExtractor.cs b/src/Umbraco.Core/Services/TagExtractor.cs index 0862971be5..754900b461 100644 --- a/src/Umbraco.Core/Services/TagExtractor.cs +++ b/src/Umbraco.Core/Services/TagExtractor.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using Newtonsoft.Json; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.Editors; diff --git a/src/Umbraco.Core/Strategies/ManifestWatcherComponent.cs b/src/Umbraco.Core/Strategies/ManifestWatcherComponent.cs index 40b77eb700..fa508029e6 100644 --- a/src/Umbraco.Core/Strategies/ManifestWatcherComponent.cs +++ b/src/Umbraco.Core/Strategies/ManifestWatcherComponent.cs @@ -1,20 +1,22 @@ using System.IO; using Umbraco.Core.Components; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; +using Umbraco.Core.Logging; using Umbraco.Core.Manifest; namespace Umbraco.Core.Strategies { + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] public class ManifestWatcherComponent : UmbracoComponentBase, IUmbracoCoreComponent { // if configured and in debug mode, a ManifestWatcher watches App_Plugins folders for // package.manifest chances and restarts the application on any change private ManifestWatcher _mw; - public void Initialize(IRuntimeState runtime) + public void Initialize(IRuntimeState runtime, ILogger logger) { - if (runtime.Level < RuntimeLevel.Run || runtime.Debug == false) return; + if (runtime.Debug == false) return; //if (ApplicationContext.Current.IsConfigured == false || GlobalSettings.DebugMode == false) // return; @@ -22,7 +24,7 @@ namespace Umbraco.Core.Strategies var appPlugins = IOHelper.MapPath("~/App_Plugins/"); if (Directory.Exists(appPlugins) == false) return; - _mw = new ManifestWatcher(Current.Logger); + _mw = new ManifestWatcher(logger); _mw.Start(Directory.GetDirectories(appPlugins)); } diff --git a/src/Umbraco.Core/Strategies/RelateOnCopyComponent.cs b/src/Umbraco.Core/Strategies/RelateOnCopyComponent.cs index aa42131dfc..d37d452d34 100644 --- a/src/Umbraco.Core/Strategies/RelateOnCopyComponent.cs +++ b/src/Umbraco.Core/Strategies/RelateOnCopyComponent.cs @@ -1,12 +1,13 @@ using System; using Umbraco.Core.Components; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models; using Umbraco.Core.Services; namespace Umbraco.Core.Strategies { //TODO: This should just exist in the content service/repo! + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] public sealed class RelateOnCopyComponent : UmbracoComponentBase, IUmbracoCoreComponent { public void Initialize() @@ -14,32 +15,31 @@ namespace Umbraco.Core.Strategies ContentService.Copied += ContentServiceCopied; } - private void ContentServiceCopied(IContentService sender, Core.Events.CopyEventArgs e) + private static void ContentServiceCopied(IContentService sender, Events.CopyEventArgs e) { - if (e.RelateToOriginal) + if (e.RelateToOriginal == false) return; + + var relationService = Current.Services.RelationService; + + var relationType = relationService.GetRelationTypeByAlias(Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias); + + if (relationType == null) { - var relationService = Current.Services.RelationService; + relationType = new RelationType(new Guid(Constants.ObjectTypes.Document), + new Guid(Constants.ObjectTypes.Document), + Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias, + Constants.Conventions.RelationTypes.RelateDocumentOnCopyName) { IsBidirectional = true }; - var relationType = relationService.GetRelationTypeByAlias(Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias); - - if (relationType == null) - { - relationType = new RelationType(new Guid(Constants.ObjectTypes.Document), - new Guid(Constants.ObjectTypes.Document), - Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias, - Constants.Conventions.RelationTypes.RelateDocumentOnCopyName) { IsBidirectional = true }; - - relationService.Save(relationType); - } - - var relation = new Relation(e.Original.Id, e.Copy.Id, relationType); - relationService.Save(relation); - - Current.Services.AuditService.Add( - AuditType.Copy, - string.Format("Copied content with Id: '{0}' related to original content with Id: '{1}'", - e.Copy.Id, e.Original.Id), e.Copy.WriterId, e.Copy.Id); + relationService.Save(relationType); } + + var relation = new Relation(e.Original.Id, e.Copy.Id, relationType); + relationService.Save(relation); + + Current.Services.AuditService.Add( + AuditType.Copy, + $"Copied content with Id: '{e.Copy.Id}' related to original content with Id: '{e.Original.Id}'", + e.Copy.WriterId, e.Copy.Id); } } } diff --git a/src/Umbraco.Core/Strategies/RelateOnTrashComponent.cs b/src/Umbraco.Core/Strategies/RelateOnTrashComponent.cs index b55ff98dbb..46879f46de 100644 --- a/src/Umbraco.Core/Strategies/RelateOnTrashComponent.cs +++ b/src/Umbraco.Core/Strategies/RelateOnTrashComponent.cs @@ -1,13 +1,14 @@ using System; using System.Linq; using Umbraco.Core.Components; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Events; using Umbraco.Core.Models; using Umbraco.Core.Services; namespace Umbraco.Core.Strategies { + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] public sealed class RelateOnTrashComponent : UmbracoComponentBase, IUmbracoCoreComponent { public void Initialize() @@ -16,12 +17,12 @@ namespace Umbraco.Core.Strategies ContentService.Trashed += ContentService_Trashed; } - private void ContentService_Moved(IContentService sender, MoveEventArgs e) + private static void ContentService_Moved(IContentService sender, MoveEventArgs e) { foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(Constants.System.RecycleBinContent.ToInvariantString()))) { var relationService = Current.Services.RelationService; - var relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias; + const string relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias; var relations = relationService.GetByChildId(item.Entity.Id); foreach (var relation in relations.Where(x => x.RelationType.Alias.InvariantEquals(relationTypeAlias))) @@ -31,17 +32,17 @@ namespace Umbraco.Core.Strategies } } - private void ContentService_Trashed(IContentService sender, MoveEventArgs e) + private static void ContentService_Trashed(IContentService sender, MoveEventArgs e) { var relationService = Current.Services.RelationService; - var relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias; + const string relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias; var relationType = relationService.GetRelationTypeByAlias(relationTypeAlias); // check that the relation-type exists, if not, then recreate it if (relationType == null) { var documentObjectType = new Guid(Constants.ObjectTypes.Document); - var relationTypeName = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName; + const string relationTypeName = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName; relationType = new RelationType(documentObjectType, documentObjectType, relationTypeAlias, relationTypeName); relationService.Save(relationType); @@ -59,7 +60,7 @@ namespace Umbraco.Core.Strategies relationService.Save(relation); Current.Services.AuditService.Add(AuditType.Delete, - string.Format("Trashed content with Id: '{0}' related to original parent content with Id: '{1}'", item.Entity.Id, originalParentId), + $"Trashed content with Id: '{item.Entity.Id}' related to original parent content with Id: '{originalParentId}'", item.Entity.WriterId, item.Entity.Id); } diff --git a/src/Umbraco.Core/StringExtensions.cs b/src/Umbraco.Core/StringExtensions.cs index ee34d442e7..8fb52e30eb 100644 --- a/src/Umbraco.Core/StringExtensions.cs +++ b/src/Umbraco.Core/StringExtensions.cs @@ -15,7 +15,7 @@ using Umbraco.Core.Configuration; using System.Web.Security; using Umbraco.Core.Strings; using Umbraco.Core.CodeAnnotations; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; namespace Umbraco.Core diff --git a/src/Umbraco.Core/Strings/UrlSegmentProviderCollection.cs b/src/Umbraco.Core/Strings/UrlSegmentProviderCollection.cs index 1b34e3ef67..13ab673e0c 100644 --- a/src/Umbraco.Core/Strings/UrlSegmentProviderCollection.cs +++ b/src/Umbraco.Core/Strings/UrlSegmentProviderCollection.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Strings { diff --git a/src/Umbraco.Core/Strings/UrlSegmentProviderCollectionBuilder.cs b/src/Umbraco.Core/Strings/UrlSegmentProviderCollectionBuilder.cs index 084970fad1..45a2bbd079 100644 --- a/src/Umbraco.Core/Strings/UrlSegmentProviderCollectionBuilder.cs +++ b/src/Umbraco.Core/Strings/UrlSegmentProviderCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Strings { diff --git a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs index a321aa583e..c9d9b60ff9 100644 --- a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs +++ b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs @@ -2,7 +2,7 @@ using System; using System.Web; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; diff --git a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs index 48658d6d0b..184e67d7c7 100644 --- a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs +++ b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs @@ -11,7 +11,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using NPoco; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Models.Rdbms; diff --git a/src/Umbraco.Core/Sync/ServerMessengerBase.cs b/src/Umbraco.Core/Sync/ServerMessengerBase.cs index 16be18ca21..5076634ea1 100644 --- a/src/Umbraco.Core/Sync/ServerMessengerBase.cs +++ b/src/Umbraco.Core/Sync/ServerMessengerBase.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Core.Sync diff --git a/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs b/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs index d249cc8f02..aef92c8688 100644 --- a/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs +++ b/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs @@ -8,7 +8,7 @@ using Newtonsoft.Json; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core.Sync { diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 95523dc18b..0c0ff2997b 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -111,6 +111,8 @@ + + @@ -118,6 +120,7 @@ + @@ -221,25 +224,25 @@ - + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -300,7 +303,7 @@ - + diff --git a/src/Umbraco.Core/UmbracoApplicationBase.cs b/src/Umbraco.Core/UmbracoApplicationBase.cs index 3713574896..86cd46e03c 100644 --- a/src/Umbraco.Core/UmbracoApplicationBase.cs +++ b/src/Umbraco.Core/UmbracoApplicationBase.cs @@ -5,7 +5,7 @@ using System.Web; using System.Web.Hosting; using log4net; using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Core diff --git a/src/Umbraco.Core/_Legacy/PackageActions/PackageActionCollection.cs b/src/Umbraco.Core/_Legacy/PackageActions/PackageActionCollection.cs index cd2a600fce..9457bcbe59 100644 --- a/src/Umbraco.Core/_Legacy/PackageActions/PackageActionCollection.cs +++ b/src/Umbraco.Core/_Legacy/PackageActions/PackageActionCollection.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core._Legacy.PackageActions { diff --git a/src/Umbraco.Core/_Legacy/PackageActions/PackageActionCollectionBuilder.cs b/src/Umbraco.Core/_Legacy/PackageActions/PackageActionCollectionBuilder.cs index 9f2f8a59a1..4fb3d9a3d0 100644 --- a/src/Umbraco.Core/_Legacy/PackageActions/PackageActionCollectionBuilder.cs +++ b/src/Umbraco.Core/_Legacy/PackageActions/PackageActionCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Core._Legacy.PackageActions { diff --git a/src/Umbraco.Tests/ApplicationUrlHelperTests.cs b/src/Umbraco.Tests/ApplicationUrlHelperTests.cs index a2dc372b17..a225d77047 100644 --- a/src/Umbraco.Tests/ApplicationUrlHelperTests.cs +++ b/src/Umbraco.Tests/ApplicationUrlHelperTests.cs @@ -12,7 +12,7 @@ using Umbraco.Core.Logging; using Umbraco.Core.Profiling; using Umbraco.Core.Sync; using Umbraco.Tests.TestHelpers; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Tests { diff --git a/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs b/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs index 626f222ef6..087ea3a506 100644 --- a/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs +++ b/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs @@ -6,7 +6,7 @@ using Moq; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Sync; @@ -27,7 +27,7 @@ namespace Umbraco.Tests.Cache.DistributedCache container.Register(_ => new TestServerRegistrar()); container.Register(_ => new TestServerMessenger(), new PerContainerLifetime()); - CacheRefresherCollectionBuilder.Register(container) + container.RegisterCollectionBuilder() .Add(); } diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs index 30dfc6da0b..b4927ea605 100644 --- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs +++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedMediaCacheTests.cs @@ -20,7 +20,7 @@ using Umbraco.Tests.TestHelpers; using Umbraco.Web; using Umbraco.Web.PublishedCache; using Umbraco.Web.PublishedCache.XmlPublishedCache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Current = Umbraco.Web.Current; namespace Umbraco.Tests.Cache.PublishedCache @@ -31,7 +31,7 @@ namespace Umbraco.Tests.Cache.PublishedCache { protected override void FreezeResolution() { - UrlSegmentProviderCollectionBuilder.Register(Container) + Container.RegisterCollectionBuilder() .Append(); base.FreezeResolution(); diff --git a/src/Umbraco.Tests/Components/ComponentTests.cs b/src/Umbraco.Tests/Components/ComponentTests.cs index b5b25a92e9..ade2ab2451 100644 --- a/src/Umbraco.Tests/Components/ComponentTests.cs +++ b/src/Umbraco.Tests/Components/ComponentTests.cs @@ -8,7 +8,7 @@ using Moq; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Components; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace Umbraco.Tests.Components @@ -192,9 +192,9 @@ namespace Umbraco.Tests.Components public class TestComponentBase : UmbracoComponentBase { - public override void Compose(ServiceContainer container) + public override void Compose(Composition composition) { - base.Compose(container); + base.Compose(composition); Composed.Add(GetType()); } } diff --git a/src/Umbraco.Tests/DependencyInjection/CollectionBuildersTests.cs b/src/Umbraco.Tests/DependencyInjection/CollectionBuildersTests.cs index b2e4efef63..510f98780a 100644 --- a/src/Umbraco.Tests/DependencyInjection/CollectionBuildersTests.cs +++ b/src/Umbraco.Tests/DependencyInjection/CollectionBuildersTests.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using LightInject; using NUnit.Framework; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Tests.DependencyInjection { @@ -100,7 +100,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void ContainsTypes() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append(); @@ -116,7 +116,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void Clear() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append(); @@ -132,7 +132,7 @@ namespace Umbraco.Tests.DependencyInjection [ExpectedException(typeof(InvalidOperationException))] public void ClearOnceResolved() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append(); @@ -143,7 +143,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void Append() { - var builder = TestCollectionBuilder.Register(_container); + var builder = _container.RegisterCollectionBuilder(); builder.Append(); builder.Append(); @@ -159,7 +159,7 @@ namespace Umbraco.Tests.DependencyInjection [ExpectedException(typeof(InvalidOperationException))] public void AppendOnceResolved() { - var builder = TestCollectionBuilder.Register(_container); + var builder = _container.RegisterCollectionBuilder(); var col = builder.CreateCollection(); builder.Append(); @@ -168,7 +168,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void AppendDuplicate() { - var builder = TestCollectionBuilder.Register(_container); + var builder = _container.RegisterCollectionBuilder(); builder.Append(); builder.Append(); @@ -180,7 +180,7 @@ namespace Umbraco.Tests.DependencyInjection [ExpectedException(typeof(InvalidOperationException))] public void AppendInvalid() { - var builder = TestCollectionBuilder.Register(_container); + var builder = _container.RegisterCollectionBuilder(); //builder.Append(); // does not compile builder.Append(new[] { typeof(Resolved4) }); // throws } @@ -188,7 +188,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void Remove() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append() .Remove(); @@ -204,7 +204,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void RemoveAbsent() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append() .Remove(); @@ -217,7 +217,7 @@ namespace Umbraco.Tests.DependencyInjection [ExpectedException(typeof(InvalidOperationException))] public void RemoveOnceResolved() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append(); @@ -228,7 +228,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void Insert() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append() .Insert(); @@ -245,7 +245,7 @@ namespace Umbraco.Tests.DependencyInjection [ExpectedException(typeof(InvalidOperationException))] public void InsertOnceResolved() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append(); @@ -256,7 +256,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void CanInsertDuplicate() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append() .Insert(); @@ -268,7 +268,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void InsertInEmpty() { - var builder = TestCollectionBuilder.Register(_container); + var builder = _container.RegisterCollectionBuilder(); builder.Insert(); var col = builder.CreateCollection(); @@ -279,7 +279,7 @@ namespace Umbraco.Tests.DependencyInjection [ExpectedException(typeof(ArgumentOutOfRangeException))] public void InsertAtWrongIndex1() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append(); @@ -290,7 +290,7 @@ namespace Umbraco.Tests.DependencyInjection [ExpectedException(typeof(ArgumentOutOfRangeException))] public void InsertAtWrongIndex2() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append(); @@ -300,7 +300,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void InsertBefore() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append() .InsertBefore(); @@ -317,7 +317,7 @@ namespace Umbraco.Tests.DependencyInjection [ExpectedException(typeof(InvalidOperationException))] public void InsertBeforeOnceResolved() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append(); @@ -328,7 +328,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void InsertBeforeDuplicate() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Append() .InsertBefore(); @@ -341,7 +341,7 @@ namespace Umbraco.Tests.DependencyInjection [ExpectedException(typeof(InvalidOperationException))] public void InsertBeforeAbsent() { - var builder = TestCollectionBuilder.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .InsertBefore(); } @@ -349,7 +349,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void ScopeIsApplication() { - TestCollectionBuilder.Register(_container) + _container.RegisterCollectionBuilder() .Append() .Append(); @@ -369,7 +369,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void ScopeIsTransient() { - TestCollectionBuilderTransient.Register(_container) + _container.RegisterCollectionBuilder() .Append() .Append(); @@ -389,7 +389,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void OrderOfTypes() { - var builder = TestCollectionBuilderTransient.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Append() .Insert() .InsertBefore(); @@ -401,7 +401,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void ScopeIsScope() { - TestCollectionBuilderScope.Register(_container) + _container.RegisterCollectionBuilder() .Append() .Append(); @@ -432,7 +432,7 @@ namespace Umbraco.Tests.DependencyInjection [Test] public void Weights() { - var builder = TestCollectionBuilderWeighted.Register(_container) + var builder = _container.RegisterCollectionBuilder() .Add() .Add(); diff --git a/src/Umbraco.Tests/DependencyInjection/LazyCollectionBuilderTests.cs b/src/Umbraco.Tests/DependencyInjection/LazyCollectionBuilderTests.cs index d94733cd41..6dc5f6ccc9 100644 --- a/src/Umbraco.Tests/DependencyInjection/LazyCollectionBuilderTests.cs +++ b/src/Umbraco.Tests/DependencyInjection/LazyCollectionBuilderTests.cs @@ -4,7 +4,7 @@ using System.Linq; using LightInject; using NUnit.Framework; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Tests.DependencyInjection { @@ -33,7 +33,7 @@ namespace Umbraco.Tests.DependencyInjection var container = new ServiceContainer(); container.ConfigureUmbracoCore(); - TestCollectionBuilder.Register(container) + container.RegisterCollectionBuilder() .Add() .Add() .Add() @@ -57,7 +57,7 @@ namespace Umbraco.Tests.DependencyInjection var container = new ServiceContainer(); container.ConfigureUmbracoCore(); - TestCollectionBuilder.Register(container) + container.RegisterCollectionBuilder() .Add(() => new[] { typeof(TransientObject3), typeof(TransientObject2) }) .Add(() => new[] { typeof(TransientObject3), typeof(TransientObject2) }) .Add(() => new[] { typeof(TransientObject1) }); @@ -80,7 +80,7 @@ namespace Umbraco.Tests.DependencyInjection var container = new ServiceContainer(); container.ConfigureUmbracoCore(); - TestCollectionBuilder.Register(container) + container.RegisterCollectionBuilder() .Add() .Add() .Add() @@ -104,7 +104,7 @@ namespace Umbraco.Tests.DependencyInjection var container = new ServiceContainer(); container.ConfigureUmbracoCore(); - TestCollectionBuilder.Register(container) + container.RegisterCollectionBuilder() .Add() // illegal, does not implement the interface! @@ -126,7 +126,7 @@ namespace Umbraco.Tests.DependencyInjection var container = new ServiceContainer(); container.ConfigureUmbracoCore(); - TestCollectionBuilder.Register(container) + container.RegisterCollectionBuilder() .Add() .Add(() => new[] { typeof(TransientObject3), typeof(TransientObject2), typeof(TransientObject1) }) .Exclude(); diff --git a/src/Umbraco.Tests/DependencyInjection/PackageActionCollectionTests.cs b/src/Umbraco.Tests/DependencyInjection/PackageActionCollectionTests.cs index a8c20289ef..54ecc89576 100644 --- a/src/Umbraco.Tests/DependencyInjection/PackageActionCollectionTests.cs +++ b/src/Umbraco.Tests/DependencyInjection/PackageActionCollectionTests.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Xml; using LightInject; using NUnit.Framework; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Plugins; using Umbraco.Core._Legacy.PackageActions; @@ -22,7 +22,7 @@ namespace Umbraco.Tests.DependencyInjection var container = new ServiceContainer(); container.ConfigureUmbracoCore(); - PackageActionCollectionBuilder.Register(container) + container.RegisterCollectionBuilder() .Add(() => PluginManager.ResolvePackageActions()); var actions = Current.PackageActions; diff --git a/src/Umbraco.Tests/DependencyInjection/ResolverBaseTest.cs b/src/Umbraco.Tests/DependencyInjection/ResolverBaseTest.cs index 29f6ae80a4..94b9ffbb65 100644 --- a/src/Umbraco.Tests/DependencyInjection/ResolverBaseTest.cs +++ b/src/Umbraco.Tests/DependencyInjection/ResolverBaseTest.cs @@ -3,7 +3,7 @@ using System.Reflection; using Moq; using NUnit.Framework; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Plugins; diff --git a/src/Umbraco.Tests/DependencyInjection/TempTests.cs b/src/Umbraco.Tests/DependencyInjection/TempTests.cs index cf933ca3d2..d4649bdb20 100644 --- a/src/Umbraco.Tests/DependencyInjection/TempTests.cs +++ b/src/Umbraco.Tests/DependencyInjection/TempTests.cs @@ -1,6 +1,6 @@ using LightInject; using NUnit.Framework; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Web.Routing; namespace Umbraco.Tests.DependencyInjection @@ -13,7 +13,7 @@ namespace Umbraco.Tests.DependencyInjection { var container = new ServiceContainer(); container.ConfigureUmbracoCore(); - UrlProviderCollectionBuilder.Register(container) + container.RegisterCollectionBuilder() .Append(); var col = container.GetInstance(); } diff --git a/src/Umbraco.Tests/Integration/ContentEventsTests.cs b/src/Umbraco.Tests/Integration/ContentEventsTests.cs index ab35a8b993..e5783d2c14 100644 --- a/src/Umbraco.Tests/Integration/ContentEventsTests.cs +++ b/src/Umbraco.Tests/Integration/ContentEventsTests.cs @@ -6,7 +6,7 @@ using Moq; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Persistence.Repositories; @@ -55,7 +55,7 @@ namespace Umbraco.Tests.Integration Container.Register(_ => new DistributedCacheTests.TestServerRegistrar()); // localhost-only Container.Register(new PerContainerLifetime()); - CacheRefresherCollectionBuilder.Register(Container) + Container.RegisterCollectionBuilder() .Add() .Add() .Add(); diff --git a/src/Umbraco.Tests/LibraryTests.cs b/src/Umbraco.Tests/LibraryTests.cs index 66698d6b69..27d5cee342 100644 --- a/src/Umbraco.Tests/LibraryTests.cs +++ b/src/Umbraco.Tests/LibraryTests.cs @@ -16,6 +16,7 @@ using Umbraco.Web; using Umbraco.Web.PublishedCache; using Umbraco.Web.PublishedCache.XmlPublishedCache; using umbraco; +using Umbraco.Core.DI; namespace Umbraco.Tests { @@ -56,7 +57,7 @@ namespace Umbraco.Tests protected override void FreezeResolution() { // required so we can access property.Value - PropertyValueConverterCollectionBuilder.Register(Container); + Container.RegisterCollectionBuilder(); base.FreezeResolution(); } diff --git a/src/Umbraco.Tests/Macros/MacroTests.cs b/src/Umbraco.Tests/Macros/MacroTests.cs index 7ec4343647..3d1428583d 100644 --- a/src/Umbraco.Tests/Macros/MacroTests.cs +++ b/src/Umbraco.Tests/Macros/MacroTests.cs @@ -17,7 +17,7 @@ using Umbraco.Web; using Umbraco.Web.Macros; using File = System.IO.File; using Macro = umbraco.cms.businesslogic.macro.Macro; -using Current = Umbraco.Core.DependencyInjection.Current; +using Current = Umbraco.Core.DI.Current; namespace Umbraco.Tests.Macros { diff --git a/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs b/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs index 1e94649322..51e58d09ca 100644 --- a/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs +++ b/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs @@ -5,7 +5,7 @@ using NPoco; using NUnit.Framework; using Semver; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.Migrations; diff --git a/src/Umbraco.Tests/Models/Mapping/AutoMapperTests.cs b/src/Umbraco.Tests/Models/Mapping/AutoMapperTests.cs index 39822f1b7e..7eb25117bf 100644 --- a/src/Umbraco.Tests/Models/Mapping/AutoMapperTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/AutoMapperTests.cs @@ -10,6 +10,7 @@ using Umbraco.Core.Logging; using Umbraco.Core.Manifest; using Umbraco.Core.PropertyEditors; using Umbraco.Tests.TestHelpers; +using Umbraco.Core.DI; namespace Umbraco.Tests.Models.Mapping { @@ -27,7 +28,7 @@ namespace Umbraco.Tests.Models.Mapping Container.Register(_ => manifestBuilder); Func> typeListProducerList = Enumerable.Empty; - PropertyEditorCollectionBuilder.Register(Container) + Container.RegisterCollectionBuilder() .Add(typeListProducerList); } diff --git a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs index 2c788e38d7..560c36e94b 100644 --- a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs @@ -12,7 +12,7 @@ using Umbraco.Core.PropertyEditors; using Umbraco.Tests.TestHelpers; using Umbraco.Tests.TestHelpers.Entities; using Umbraco.Web.Models.ContentEditing; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Current = Umbraco.Web.Current; namespace Umbraco.Tests.Models.Mapping diff --git a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs index 19f8ea504a..5b7de3f020 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs @@ -8,7 +8,7 @@ using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Configuration.UmbracoSettings; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Models; diff --git a/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs b/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs index 4fbfeb305e..da3591eb84 100644 --- a/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs +++ b/src/Umbraco.Tests/PropertyEditors/ImageCropperTest.cs @@ -6,7 +6,7 @@ using Newtonsoft.Json; using NUnit.Framework; using Newtonsoft.Json.Linq; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; @@ -64,7 +64,7 @@ namespace Umbraco.Tests.PropertyEditors { var container = new ServiceContainer(); container.ConfigureUmbracoCore(); - PropertyValueConverterCollectionBuilder.Register(container); + container.RegisterCollectionBuilder(); var dataTypeService = new Mock(); dataTypeService.Setup(x => x.GetPreValuesCollectionByDataTypeId(It.IsAny())).Returns(new PreValueCollection(Enumerable.Empty())); @@ -84,7 +84,7 @@ namespace Umbraco.Tests.PropertyEditors } finally { - Core.DependencyInjection.Current.Reset(); + Core.DI.Current.Reset(); } } diff --git a/src/Umbraco.Tests/PropertyEditors/MultiValuePropertyEditorTests.cs b/src/Umbraco.Tests/PropertyEditors/MultiValuePropertyEditorTests.cs index b32ae63930..4c79f5f61d 100644 --- a/src/Umbraco.Tests/PropertyEditors/MultiValuePropertyEditorTests.cs +++ b/src/Umbraco.Tests/PropertyEditors/MultiValuePropertyEditorTests.cs @@ -5,7 +5,7 @@ using Moq; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Profiling; diff --git a/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs b/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs index e0686a5efb..e25ab0678a 100644 --- a/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs +++ b/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs @@ -4,7 +4,7 @@ using LightInject; using Moq; using NUnit.Framework; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models; using Umbraco.Core.PropertyEditors; using Umbraco.Core.Services; diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs index 036b7c59b0..fdb973d2a1 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs @@ -13,8 +13,8 @@ using Umbraco.Core.Plugins; using Umbraco.Web.PublishedCache; using Umbraco.Web.Routing; using Umbraco.Web.Security; -using Umbraco.Core.DependencyInjection; -using Current = Umbraco.Core.DependencyInjection.Current; +using Umbraco.Core.DI; +using Current = Umbraco.Core.DI.Current; namespace Umbraco.Tests.PublishedContent { @@ -34,7 +34,7 @@ namespace Umbraco.Tests.PublishedContent // this is so the model factory looks into the test assembly _pluginManager = Current.PluginManager; - Core.DependencyInjection.Current.PluginManager = new PluginManager(new NullCacheProvider(), ProfilingLogger, false) + Core.DI.Current.PluginManager = new PluginManager(new NullCacheProvider(), ProfilingLogger, false) { AssembliesToScan = _pluginManager.AssembliesToScan .Union(new[] { typeof (PublishedContentMoreTests).Assembly}) @@ -45,7 +45,7 @@ namespace Umbraco.Tests.PublishedContent protected override void FreezeResolution() { - PropertyValueConverterCollectionBuilder.Register(Container); + Container.RegisterCollectionBuilder(); var types = Current.PluginManager.ResolveTypes(); Container.RegisterSingleton(_ => new PublishedContentModelFactory(types)); @@ -77,7 +77,7 @@ namespace Umbraco.Tests.PublishedContent { base.TearDown(); - Core.DependencyInjection.Current.Reset(); + Core.DI.Current.Reset(); } [Test] diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs index a9cd32d4a8..6b3788076e 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs @@ -1,4 +1,5 @@ using Umbraco.Core; +using Umbraco.Core.DI; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.PropertyEditors; using Umbraco.Core.PropertyEditors.ValueConverters; @@ -33,7 +34,7 @@ namespace Umbraco.Tests.PublishedContent { // fixme - what about the if (PropertyValueConvertersResolver.HasCurrent == false) ?? // can we risk double - registering and then, what happens? - PropertyValueConverterCollectionBuilder.Register(Container) + Container.RegisterCollectionBuilder() .Append() .Append() .Append(); diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs index 5de34c6fc3..ce83e6acf9 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs @@ -9,8 +9,8 @@ using Umbraco.Core.Plugins; using Umbraco.Core.PropertyEditors; using Umbraco.Web; using Umbraco.Web.PublishedCache; -using Umbraco.Core.DependencyInjection; -using Current = Umbraco.Core.DependencyInjection.Current; +using Umbraco.Core.DI; +using Current = Umbraco.Core.DI.Current; namespace Umbraco.Tests.PublishedContent { @@ -31,7 +31,7 @@ namespace Umbraco.Tests.PublishedContent // this is so the model factory looks into the test assembly _pluginManager = Current.PluginManager; - Core.DependencyInjection.Current.PluginManager = new PluginManager(CacheHelper.RuntimeCache, ProfilingLogger, false) + Core.DI.Current.PluginManager = new PluginManager(CacheHelper.RuntimeCache, ProfilingLogger, false) { AssembliesToScan = _pluginManager.AssembliesToScan .Union(new[] { typeof(PublishedContentTests).Assembly }) @@ -61,7 +61,7 @@ namespace Umbraco.Tests.PublishedContent base.TearDown(); // fixme - wtf, restoring? keeping it accross tests for perfs I guess? //PluginManager.Current = _pluginManager; - Core.DependencyInjection.Current.Reset(); + Core.DI.Current.Reset(); } protected override void FreezeResolution() diff --git a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs index 07893050e4..194f0baac8 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs @@ -18,6 +18,7 @@ using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.Strings; using UmbracoExamine; using Current = Umbraco.Web.Current; +using Umbraco.Core.DI; namespace Umbraco.Tests.PublishedContent { @@ -33,7 +34,7 @@ namespace Umbraco.Tests.PublishedContent /// protected override void FreezeResolution() { - UrlSegmentProviderCollectionBuilder.Register(Container) + Container.RegisterCollectionBuilder() .Append(); base.FreezeResolution(); diff --git a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs index 2a448f4218..099ceaa7f1 100644 --- a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs +++ b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs @@ -16,7 +16,7 @@ using Umbraco.Web.Mvc; using Umbraco.Web.Routing; using Umbraco.Web.WebApi; using Umbraco.Core.Strings; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Current = Umbraco.Web.Current; namespace Umbraco.Tests.Routing diff --git a/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs b/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs index 641e577a7e..73b88f52fa 100644 --- a/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs +++ b/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs @@ -7,7 +7,7 @@ using Semver; using Umbraco.Core; using Umbraco.Core.Components; using Umbraco.Core.Configuration.UmbracoSettings; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; using Umbraco.Core.Services; @@ -157,15 +157,15 @@ namespace Umbraco.Tests.Runtimes Ctored = true; } - public override void Compose(ServiceContainer container) + public override void Compose(Composition composition) { - base.Compose(container); + base.Compose(composition); - container.Register(factory => SettingsForTests.GetDefault()); - container.Register(factory => new DatabaseContext( + composition.Container.Register(factory => SettingsForTests.GetDefault()); + composition.Container.Register(factory => new DatabaseContext( factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), Mock.Of()), new PerContainerLifetime()); - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); Composed = true; } diff --git a/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs b/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs index 4c4442a9f8..f3dd0751eb 100644 --- a/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs +++ b/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs @@ -23,7 +23,7 @@ using Umbraco.Tests.TestHelpers.Entities; using Umbraco.Core.Events; using Umbraco.Core.Persistence.Mappers; using Umbraco.Core.Persistence.Querying; -using Current = Umbraco.Core.DependencyInjection.Current; +using Current = Umbraco.Core.DI.Current; namespace Umbraco.Tests.Services { diff --git a/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs b/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs index ae16dc7184..0467ca9a16 100644 --- a/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs +++ b/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs @@ -10,7 +10,7 @@ using Moq; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Configuration.UmbracoSettings; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Strings; using Umbraco.Tests.TestHelpers; diff --git a/src/Umbraco.Tests/Strings/StringExtensionsTests.cs b/src/Umbraco.Tests/Strings/StringExtensionsTests.cs index a6d30836bf..9a31934bf9 100644 --- a/src/Umbraco.Tests/Strings/StringExtensionsTests.cs +++ b/src/Umbraco.Tests/Strings/StringExtensionsTests.cs @@ -4,7 +4,7 @@ using System.Globalization; using LightInject; using NUnit.Framework; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Strings; namespace Umbraco.Tests.Strings diff --git a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs index 1190a68dbe..84c439ea2c 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs @@ -30,6 +30,7 @@ using Umbraco.Core.Events; using Umbraco.Core.Plugins; using Umbraco.Web.Routing; using File = System.IO.File; +using Umbraco.Core.DI; namespace Umbraco.Tests.TestHelpers { @@ -85,8 +86,8 @@ namespace Umbraco.Tests.TestHelpers new ManifestParser(Logger, new DirectoryInfo(IOHelper.MapPath("~/App_Plugins")), new NullCacheProvider())); Container.Register(_ => manifestBuilder); - PropertyEditorCollectionBuilder.Register(Container) - .Add(() => Current.PluginManager.ResolvePropertyEditors()); + Container.RegisterCollectionBuilder() + .Add(() => Core.DI.Current.PluginManager.ResolvePropertyEditors()); } private CacheHelper _disabledCacheHelper; @@ -263,7 +264,7 @@ namespace Umbraco.Tests.TestHelpers protected override void FreezeResolution() { // fixme - what about if (PropertyValueConvertersResolver.HasCurrent == false) ?? - PropertyValueConverterCollectionBuilder.Register(Container); + Container.RegisterCollectionBuilder(); // ensure we have a FacadeService if (_facadeService == null) @@ -274,17 +275,17 @@ namespace Umbraco.Tests.TestHelpers var enableRepositoryEvents = behavior != null && behavior.EnableRepositoryEvents; ContentTypesCache = new PublishedContentTypeCache( - Current.Services.ContentTypeService, - Current.Services.MediaTypeService, - Current.Services.MemberTypeService, - Current.Logger); + Core.DI.Current.Services.ContentTypeService, + Core.DI.Current.Services.MediaTypeService, + Core.DI.Current.Services.MemberTypeService, + Core.DI.Current.Logger); // testing=true so XmlStore will not use the file nor the database var facadeAccessor = new TestFacadeAccessor(); var service = new FacadeService( - Current.Services, + Core.DI.Current.Services, _uowProvider, - cache, facadeAccessor, Current.Logger, ContentTypesCache, null, true, enableRepositoryEvents); + cache, facadeAccessor, Core.DI.Current.Logger, ContentTypesCache, null, true, enableRepositoryEvents); // initialize PublishedCacheService content with an Xml source service.XmlStore.GetXmlDocument = () => @@ -318,7 +319,7 @@ namespace Umbraco.Tests.TestHelpers || DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerTest || (_isFirstTestInFixture && DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerFixture))) { - var database = Current.DatabaseContext.Database; + var database = Core.DI.Current.DatabaseContext.Database; var schemaHelper = new DatabaseSchemaHelper(database, Logger); //Create the umbraco database and its base data schemaHelper.CreateDatabaseSchema(Mock.Of(), Mock.Of()); @@ -334,7 +335,7 @@ namespace Umbraco.Tests.TestHelpers [TestFixtureTearDown] public void FixtureTearDown() { - RemoveDatabaseFile(Current.DatabaseContext.Database); + RemoveDatabaseFile(Core.DI.Current.DatabaseContext.Database); } [TearDown] @@ -346,7 +347,7 @@ namespace Umbraco.Tests.TestHelpers if (DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerTest) { - RemoveDatabaseFile(Current.DatabaseContext.Database); + RemoveDatabaseFile(Core.DI.Current.DatabaseContext.Database); } AppDomain.CurrentDomain.SetData("DataDirectory", null); @@ -407,16 +408,16 @@ namespace Umbraco.Tests.TestHelpers } catch (Exception ex) { - Current.Logger.Error("Could not remove the old database file", ex); + Core.DI.Current.Logger.Error("Could not remove the old database file", ex); //We will swallow this exception! That's because a sub class might require further teardown logic. onFail?.Invoke(ex); } } - protected ServiceContext ServiceContext => Current.Services; + protected ServiceContext ServiceContext => Core.DI.Current.Services; - protected DatabaseContext DatabaseContext => Current.DatabaseContext; + protected DatabaseContext DatabaseContext => Core.DI.Current.DatabaseContext; protected UmbracoContext GetUmbracoContext(string url, int templateId, RouteData routeData = null, bool setSingleton = false) { @@ -437,7 +438,7 @@ namespace Umbraco.Tests.TestHelpers var ctx = UmbracoContext.CreateContext( httpContext, service, - new WebSecurity(httpContext, Current.Services.UserService), + new WebSecurity(httpContext, Core.DI.Current.Services.UserService), Mock.Of(), Enumerable.Empty()); diff --git a/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs b/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs index 559521e0c1..0ee9dfa27b 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs @@ -19,7 +19,7 @@ using Umbraco.Core.Profiling; using Umbraco.Core.PropertyEditors; using Umbraco.Core.Strings; using Umbraco.Web; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Persistence.Mappers; using Umbraco.Core.Events; using Umbraco.Core.Models.PublishedContent; @@ -83,13 +83,13 @@ namespace Umbraco.Tests.TestHelpers TestHelper.CleanUmbracoSettingsConfig(); // reset the app context, this should reset most things that require resetting like ALL resolvers - Core.DependencyInjection.Current.Reset(); + Core.DI.Current.Reset(); // reset plugin manager ResetPluginManager(); Container.Dispose(); - Core.DependencyInjection.Current.Reset(); + Core.DI.Current.Reset(); } protected virtual void ConfigureContainer() @@ -192,7 +192,7 @@ namespace Umbraco.Tests.TestHelpers { if (PluginManagerResetRequired) { - Core.DependencyInjection.Current.PluginManager = null; + Core.DI.Current.PluginManager = null; } } @@ -252,7 +252,7 @@ namespace Umbraco.Tests.TestHelpers // fixme - oops if (/*PluginManager.Current == null ||*/ PluginManagerResetRequired) { - Core.DependencyInjection.Current.PluginManager = new PluginManager(CacheHelper.RuntimeCache, ProfilingLogger, false) + Core.DI.Current.PluginManager = new PluginManager(CacheHelper.RuntimeCache, ProfilingLogger, false) { AssembliesToScan = new[] { diff --git a/src/Umbraco.Tests/TestHelpers/BaseUmbracoConfigurationTest.cs b/src/Umbraco.Tests/TestHelpers/BaseUmbracoConfigurationTest.cs index 4848ca6e1b..380457bbae 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseUmbracoConfigurationTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseUmbracoConfigurationTest.cs @@ -1,5 +1,5 @@ using NUnit.Framework; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Current = Umbraco.Web.Current; namespace Umbraco.Tests.TestHelpers diff --git a/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs b/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs index 3bc1f1d7cd..e810e9f317 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs @@ -8,7 +8,7 @@ using Umbraco.Core.Logging; using Umbraco.Core.Persistence.Mappers; using Umbraco.Core.Persistence.SqlSyntax; using Umbraco.Core.Profiling; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Persistence; using Umbraco.Core.Plugins; @@ -43,7 +43,7 @@ namespace Umbraco.Tests.TestHelpers false); container.RegisterInstance(pluginManager); - MapperCollectionBuilder.Register(container) + container.RegisterCollectionBuilder() .Add(() => Current.PluginManager.ResolveAssignedMapperTypes()); Mappers = container.GetInstance(); diff --git a/src/Umbraco.Tests/TryConvertToTests.cs b/src/Umbraco.Tests/TryConvertToTests.cs index 4834776956..e537e7f465 100644 --- a/src/Umbraco.Tests/TryConvertToTests.cs +++ b/src/Umbraco.Tests/TryConvertToTests.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Strings; using Umbraco.Tests.TestHelpers; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Tests { diff --git a/src/Umbraco.Tests/UmbracoExamine/ExamineBaseTest.cs b/src/Umbraco.Tests/UmbracoExamine/ExamineBaseTest.cs index 2121a639c1..5c958f6ed6 100644 --- a/src/Umbraco.Tests/UmbracoExamine/ExamineBaseTest.cs +++ b/src/Umbraco.Tests/UmbracoExamine/ExamineBaseTest.cs @@ -3,7 +3,7 @@ using System.IO; using LightInject; using NUnit.Framework; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Persistence.Mappers; using Umbraco.Core.Profiling; diff --git a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs index 62404f3c39..282d9de5cb 100644 --- a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs @@ -23,7 +23,7 @@ using Umbraco.Web.Mvc; using Umbraco.Web.PublishedCache; using Umbraco.Web.Routing; using Umbraco.Web.Security; -using Current = Umbraco.Core.DependencyInjection.Current; +using Current = Umbraco.Core.DI.Current; namespace Umbraco.Tests.Web.Mvc { diff --git a/src/Umbraco.Web/Cache/CacheRefresherComponent.cs b/src/Umbraco.Web/Cache/CacheRefresherComponent.cs index c1b443dda5..defd3f97a9 100644 --- a/src/Umbraco.Web/Cache/CacheRefresherComponent.cs +++ b/src/Umbraco.Web/Cache/CacheRefresherComponent.cs @@ -18,6 +18,7 @@ namespace Umbraco.Web.Cache /// /// Installs listeners on service events in order to refresh our caches. /// + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] public class CacheRefresherComponent : UmbracoComponentBase, IUmbracoCoreComponent { public void Initialize() diff --git a/src/Umbraco.Web/CompositionExtensions.cs b/src/Umbraco.Web/CompositionExtensions.cs new file mode 100644 index 0000000000..c7198b4d0e --- /dev/null +++ b/src/Umbraco.Web/CompositionExtensions.cs @@ -0,0 +1,211 @@ +using System; +using LightInject; +using Umbraco.Core.Dictionary; +using Umbraco.Core.DI; +using Umbraco.Core.Macros; +using Umbraco.Core.Models.PublishedContent; +using Umbraco.Core.Persistence.Mappers; +using Umbraco.Core.Persistence.Migrations; +using Umbraco.Core.Sync; +using Umbraco.Web.Editors; +using Umbraco.Web.HealthCheck; +using Umbraco.Web.Media; +using Umbraco.Web.Media.ThumbnailProviders; +using Umbraco.Web.Mvc; +using Umbraco.Web.PublishedCache; +using Umbraco.Web.Routing; +using Umbraco.Web.Strategies.Migrations; +using Umbraco.Web._Legacy.Actions; + +// the namespace here is intentional - although defined in Umbraco.Web assembly, +// this class should be visible when using Umbraco.Core.Components, alongside +// Umbraco.Core's own CompositionExtensions class + +// ReSharper disable once CheckNamespace +namespace Umbraco.Core.Components +{ + /// + /// Provides extension methods to the class. + /// + public static class WebCompositionExtensions + { + #region Collection Builders + + /// + /// Gets the actions collection builder. + /// + /// The composition. + /// + internal static ActionCollectionBuilder Actions(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the content finders collection builder. + /// + /// The composition. + /// + internal static XsltExtensionCollectionBuilder XsltExtensions(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the content finders collection builder. + /// + /// The composition. + /// + public static ContentFinderCollectionBuilder ContentFinders(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the editor validators collection builder. + /// + /// The composition. + /// + internal static EditorValidatorCollectionBuilder EditorValidators(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the filtered controller factories collection builder. + /// + /// The composition. + /// + public static FilteredControllerFactoryCollectionBuilder FilderedControllerFactory(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the health checks collection builder. + /// + /// The composition. + public static HealthCheckCollectionBuilder HealthChecks(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the image url providers collection builder. + /// + /// The composition. + internal static ImageUrlProviderCollectionBuilder ImageUrlProviders(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the thumbnail providers collection builder. + /// + /// The composition. + internal static ThumbnailProviderCollectionBuilder ThumbnailProviders(this Composition composition) + => composition.Container.GetInstance(); + + /// + /// Gets the url providers collection builder. + /// + /// The composition. + internal static UrlProviderCollectionBuilder UrlProviders(this Composition composition) + => composition.Container.GetInstance(); + + #endregion + + #region Singletons + + /// + /// Sets the content last chance finder. + /// + /// The type of the content last chance finder. + /// The composition. + public static void SetContentLastChanceFinder(this Composition composition) + where T : IContentLastChanceFinder + { + composition.Container.RegisterSingleton(); + } + + /// + /// Sets the content last chance finder. + /// + /// The composition. + /// A function creating a last chance finder. + public static void SetContentLastChanceFinder(this Composition composition, Func factory) + { + composition.Container.RegisterSingleton(factory); + } + + /// + /// Sets the content last chance finder. + /// + /// The composition. + /// A last chance finder. + public static void SetContentLastChanceFinder(this Composition composition, IContentLastChanceFinder finder) + { + composition.Container.RegisterSingleton(_ => finder); + } + + /// + /// Sets the type of the default rendering controller. + /// + /// The type of the default rendering controller. + /// The composition. + public static void SetDefaultRenderMvcControllerType(this Composition composition) + { + Web.Current.DefaultRenderMvcControllerType = typeof(T); + } + + /// + /// Sets the facade service. + /// + /// The type of the facade service. + /// The composition. + public static void SetFacadeService(this Composition composition) + where T : IFacadeService + { + composition.Container.RegisterSingleton(); + } + + /// + /// Sets the facade service. + /// + /// The composition. + /// A function creating a service facade. + public static void SetFacadeService(this Composition composition, Func factory) + { + composition.Container.RegisterSingleton(factory); + } + + /// + /// Sets the facade service. + /// + /// The composition. + /// A facade service. + public static void SetFacadeService(this Composition composition, IFacadeService service) + { + composition.Container.RegisterSingleton(_ => service); + } + + /// + /// Sets the site domain helper. + /// + /// The type of the site domain helper. + /// + public static void SetSiteDomainHelper(this Composition composition) + where T : ISiteDomainHelper + { + composition.Container.RegisterSingleton(); + } + + /// + /// Sets the site domain helper. + /// + /// The composition. + /// A function creating a helper. + public static void SetSiteDomainHelper(this Composition composition, Func factory) + { + composition.Container.RegisterSingleton(factory); + } + + /// + /// Sets the site domain helper. + /// + /// The composition. + /// A helper. + public static void SetSiteDomainHelper(this Composition composition, ISiteDomainHelper helper) + { + composition.Container.RegisterSingleton(_ => helper); + } + + #endregion + } +} diff --git a/src/Umbraco.Web/Current.cs b/src/Umbraco.Web/Current.cs index ba7e496665..d5ee7776e8 100644 --- a/src/Umbraco.Web/Current.cs +++ b/src/Umbraco.Web/Current.cs @@ -25,7 +25,7 @@ using Umbraco.Web.PublishedCache; using Umbraco.Web.Routing; using Umbraco.Web.WebApi; using Umbraco.Web._Legacy.Actions; -using CoreCurrent = Umbraco.Core.DependencyInjection.Current; +using CoreCurrent = Umbraco.Core.DI.Current; namespace Umbraco.Web { @@ -187,15 +187,14 @@ namespace Umbraco.Web private static Type _defaultRenderMvcControllerType; - public static Type DefaultRenderMvcControllerType + // internal - can only be accessed through Composition at compose time + internal static Type DefaultRenderMvcControllerType { get { return _defaultRenderMvcControllerType; } set { if (value.Implements() == false) throw new ArgumentException($"Type {value.FullName} does not implement {typeof (IRenderController).FullName}.", nameof(value)); - - // fixme - must lock + ensure we're not frozen? _defaultRenderMvcControllerType = value; } } diff --git a/src/Umbraco.Web/Editors/EditorValidatorCollection.cs b/src/Umbraco.Web/Editors/EditorValidatorCollection.cs index 4ecc312911..07c7b0d8b4 100644 --- a/src/Umbraco.Web/Editors/EditorValidatorCollection.cs +++ b/src/Umbraco.Web/Editors/EditorValidatorCollection.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Editors { diff --git a/src/Umbraco.Web/Editors/EditorValidatorCollectionBuilder.cs b/src/Umbraco.Web/Editors/EditorValidatorCollectionBuilder.cs index a82f5db0e9..0061e39905 100644 --- a/src/Umbraco.Web/Editors/EditorValidatorCollectionBuilder.cs +++ b/src/Umbraco.Web/Editors/EditorValidatorCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Editors { diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckCollection.cs b/src/Umbraco.Web/HealthCheck/HealthCheckCollection.cs index 070ee4303e..a65d8199b4 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckCollection.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckCollection.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.HealthCheck { diff --git a/src/Umbraco.Web/HealthCheck/HeathCheckCollectionBuilder.cs b/src/Umbraco.Web/HealthCheck/HeathCheckCollectionBuilder.cs index 18a914c481..dfd7b39b9f 100644 --- a/src/Umbraco.Web/HealthCheck/HeathCheckCollectionBuilder.cs +++ b/src/Umbraco.Web/HealthCheck/HeathCheckCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.HealthCheck { diff --git a/src/Umbraco.Web/Media/ImageUrlProviderCollection.cs b/src/Umbraco.Web/Media/ImageUrlProviderCollection.cs index b4391dc5f8..17c9d48686 100644 --- a/src/Umbraco.Web/Media/ImageUrlProviderCollection.cs +++ b/src/Umbraco.Web/Media/ImageUrlProviderCollection.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Media; using Umbraco.Web.Media.ImageUrlProviders; diff --git a/src/Umbraco.Web/Media/ImageUrlProviderCollectionBuilder.cs b/src/Umbraco.Web/Media/ImageUrlProviderCollectionBuilder.cs index d63045ed62..a1e68e3608 100644 --- a/src/Umbraco.Web/Media/ImageUrlProviderCollectionBuilder.cs +++ b/src/Umbraco.Web/Media/ImageUrlProviderCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Media; namespace Umbraco.Web.Media diff --git a/src/Umbraco.Web/Media/ThumbnailProviders/FileExtensionIconThumbnailProvider.cs b/src/Umbraco.Web/Media/ThumbnailProviders/FileExtensionIconThumbnailProvider.cs index 6acdb0d75a..5431324008 100644 --- a/src/Umbraco.Web/Media/ThumbnailProviders/FileExtensionIconThumbnailProvider.cs +++ b/src/Umbraco.Web/Media/ThumbnailProviders/FileExtensionIconThumbnailProvider.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; namespace Umbraco.Web.Media.ThumbnailProviders diff --git a/src/Umbraco.Web/Media/ThumbnailProviders/ImageThumbnailProvider.cs b/src/Umbraco.Web/Media/ThumbnailProviders/ImageThumbnailProvider.cs index 4d5f3d0b1e..b00b3987d1 100644 --- a/src/Umbraco.Web/Media/ThumbnailProviders/ImageThumbnailProvider.cs +++ b/src/Umbraco.Web/Media/ThumbnailProviders/ImageThumbnailProvider.cs @@ -4,7 +4,7 @@ using System.IO; using System.Linq; using System.Text; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; namespace Umbraco.Web.Media.ThumbnailProviders diff --git a/src/Umbraco.Web/Media/ThumbnailProviders/MediaTypeIconThumbnailProvider.cs b/src/Umbraco.Web/Media/ThumbnailProviders/MediaTypeIconThumbnailProvider.cs index d9344864e7..b0c3f68aa9 100644 --- a/src/Umbraco.Web/Media/ThumbnailProviders/MediaTypeIconThumbnailProvider.cs +++ b/src/Umbraco.Web/Media/ThumbnailProviders/MediaTypeIconThumbnailProvider.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; namespace Umbraco.Web.Media.ThumbnailProviders diff --git a/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProviderCollection.cs b/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProviderCollection.cs index 2f69f4f765..e78814cd20 100644 --- a/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProviderCollection.cs +++ b/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProviderCollection.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Media; namespace Umbraco.Web.Media.ThumbnailProviders diff --git a/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProviderCollectionBuilder.cs b/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProviderCollectionBuilder.cs index e3454efbd6..e6f03c01e4 100644 --- a/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProviderCollectionBuilder.cs +++ b/src/Umbraco.Web/Media/ThumbnailProviders/ThumbnailProviderCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Media; namespace Umbraco.Web.Media.ThumbnailProviders diff --git a/src/Umbraco.Web/Mvc/FilteredControllerFactoryCollection.cs b/src/Umbraco.Web/Mvc/FilteredControllerFactoryCollection.cs index 4fdf5212f3..e30fca2674 100644 --- a/src/Umbraco.Web/Mvc/FilteredControllerFactoryCollection.cs +++ b/src/Umbraco.Web/Mvc/FilteredControllerFactoryCollection.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Mvc { diff --git a/src/Umbraco.Web/Mvc/FilteredControllerFactoryCollectionBuilder.cs b/src/Umbraco.Web/Mvc/FilteredControllerFactoryCollectionBuilder.cs index 8795eb4ae6..96f61f767c 100644 --- a/src/Umbraco.Web/Mvc/FilteredControllerFactoryCollectionBuilder.cs +++ b/src/Umbraco.Web/Mvc/FilteredControllerFactoryCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Mvc { diff --git a/src/Umbraco.Web/Mvc/SurfaceControllerTypeCollection.cs b/src/Umbraco.Web/Mvc/SurfaceControllerTypeCollection.cs index 0e3e888d35..e8651e2007 100644 --- a/src/Umbraco.Web/Mvc/SurfaceControllerTypeCollection.cs +++ b/src/Umbraco.Web/Mvc/SurfaceControllerTypeCollection.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Mvc { diff --git a/src/Umbraco.Web/PropertyEditors/PropertyEditorsComponent.cs b/src/Umbraco.Web/PropertyEditors/PropertyEditorsComponent.cs index 86bc06f7fb..37d65bd50b 100644 --- a/src/Umbraco.Web/PropertyEditors/PropertyEditorsComponent.cs +++ b/src/Umbraco.Web/PropertyEditors/PropertyEditorsComponent.cs @@ -8,6 +8,7 @@ using UmbracoExamine; namespace Umbraco.Web.PropertyEditors { + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] internal class PropertyEditorsComponent : UmbracoComponentBase, IUmbracoCoreComponent { public void Initialize(IRuntimeState runtime, PropertyEditorCollection propertyEditors, IExamineIndexCollectionAccessor indexCollection) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComponent.cs b/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComponent.cs index 2d98eadd11..53b236d5c8 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComponent.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComponent.cs @@ -1,7 +1,5 @@ -using LightInject; -using Umbraco.Core; +using Umbraco.Core; using Umbraco.Core.Components; -using Umbraco.Core.DependencyInjection; using Umbraco.Core.Logging; using Umbraco.Core.Persistence.UnitOfWork; using Umbraco.Core.Services; @@ -10,12 +8,12 @@ namespace Umbraco.Web.PublishedCache.NuCache { public class NuCacheComponent : UmbracoComponentBase, IUmbracoCoreComponent { - public override void Compose(ServiceContainer container) + public override void Compose(Composition composition) { - base.Compose(container); + base.Compose(composition); // register the NuCache facade service - container.RegisterSingleton(factory => new FacadeService( + composition.SetFacadeService(factory => new FacadeService( new FacadeService.Options { FacadeCacheIsApplicationRequestCache = true }, factory.GetInstance(), factory.GetInstance(), @@ -26,8 +24,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // add the NuCache health check (hidden from type finder) // todo - no NuCache health check yet - //var builder = container.GetInstance(); - //builder.Add(); + //composition.HealthChecks().Add(); } public void Initialize(IFacadeService service) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheComponent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheComponent.cs index a2d63fdb51..97be953d33 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheComponent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheComponent.cs @@ -1,13 +1,10 @@ -using LightInject; -using Umbraco.Core; +using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Components; using Umbraco.Core.Persistence.UnitOfWork; using Umbraco.Core.Services; using Umbraco.Core.Strings; -using Umbraco.Core.DependencyInjection; using Umbraco.Core.Logging; -using Umbraco.Web.HealthCheck; using Umbraco.Web.HealthCheck.Checks.DataIntegrity; namespace Umbraco.Web.PublishedCache.XmlPublishedCache @@ -15,23 +12,22 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache [DisableComponent] // is not enabled by default public class XmlCacheComponent : UmbracoComponentBase, IUmbracoCoreComponent { - public override void Compose(ServiceContainer container) + public override void Compose(Composition composition) { - base.Compose(container); + base.Compose(composition); // register the XML facade service - container.RegisterSingleton(factory => new FacadeService( + composition.SetFacadeService(factory => new FacadeService( factory.GetInstance(), factory.GetInstance(), factory.GetInstance().RequestCache, - factory.GetAllInstances(), + factory.GetInstance(), factory.GetInstance(), factory.GetInstance(), factory.GetInstance())); // add the Xml cache health check (hidden from type finder) - var builder = container.GetInstance(); - builder.Exclude(); + composition.HealthChecks().Add(); } public void Initialize(IFacadeService service) diff --git a/src/Umbraco.Web/Redirects/RedirectTrackingComponent.cs b/src/Umbraco.Web/Redirects/RedirectTrackingComponent.cs index c23ca26f05..675d4ca2f3 100644 --- a/src/Umbraco.Web/Redirects/RedirectTrackingComponent.cs +++ b/src/Umbraco.Web/Redirects/RedirectTrackingComponent.cs @@ -6,7 +6,6 @@ using Umbraco.Core.Events; using System.Collections.Generic; using Umbraco.Core.Cache; using Umbraco.Core.Components; -using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.Sync; using Umbraco.Web.Cache; @@ -20,6 +19,7 @@ namespace Umbraco.Web.Redirects /// not managing domains because we don't know how to do it - changing domains => must create a higher level strategy using rewriting rules probably /// recycle bin = moving to and from does nothing: to = the node is gone, where would we redirect? from = same /// + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] public class RedirectTrackingComponent : UmbracoComponentBase, IUmbracoCoreComponent { private const string ContextKey1 = "Umbraco.Web.Redirects.RedirectTrackingEventHandler.1"; diff --git a/src/Umbraco.Web/Routing/ContentFinderCollection.cs b/src/Umbraco.Web/Routing/ContentFinderCollection.cs index c8e45d4f2b..71520b2540 100644 --- a/src/Umbraco.Web/Routing/ContentFinderCollection.cs +++ b/src/Umbraco.Web/Routing/ContentFinderCollection.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Routing { diff --git a/src/Umbraco.Web/Routing/ContentFinderCollectionBuilder.cs b/src/Umbraco.Web/Routing/ContentFinderCollectionBuilder.cs index 14e9f1ac29..88f57ef2e1 100644 --- a/src/Umbraco.Web/Routing/ContentFinderCollectionBuilder.cs +++ b/src/Umbraco.Web/Routing/ContentFinderCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Routing { diff --git a/src/Umbraco.Web/Routing/UrlProviderCollection.cs b/src/Umbraco.Web/Routing/UrlProviderCollection.cs index 9148be6183..60df7fac7c 100644 --- a/src/Umbraco.Web/Routing/UrlProviderCollection.cs +++ b/src/Umbraco.Web/Routing/UrlProviderCollection.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Routing { diff --git a/src/Umbraco.Web/Routing/UrlProviderCollectionBuilder.cs b/src/Umbraco.Web/Routing/UrlProviderCollectionBuilder.cs index 577c35be8c..cdd0ec7995 100644 --- a/src/Umbraco.Web/Routing/UrlProviderCollectionBuilder.cs +++ b/src/Umbraco.Web/Routing/UrlProviderCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Routing { diff --git a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs index 6f7f756e7b..2689742e14 100644 --- a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs +++ b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs @@ -16,6 +16,7 @@ namespace Umbraco.Web.Scheduling /// All tasks are run in a background task runner which is web aware and will wind down /// the task correctly instead of killing it completely when the app domain shuts down. /// + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] internal sealed class SchedulerComponent : UmbracoComponentBase, IUmbracoCoreComponent { private IRuntimeState _runtime; diff --git a/src/Umbraco.Web/Search/ExamineComponent.cs b/src/Umbraco.Web/Search/ExamineComponent.cs index cee52f7ddb..5348469f05 100644 --- a/src/Umbraco.Web/Search/ExamineComponent.cs +++ b/src/Umbraco.Web/Search/ExamineComponent.cs @@ -21,10 +21,11 @@ using UmbracoExamine; namespace Umbraco.Web.Search { - /// - /// Used to wire up events for Examine - /// - public sealed class ExamineComponent : UmbracoComponentBase, IUmbracoCoreComponent + /// + /// Used to wire up events for Examine + /// + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] + public sealed class ExamineComponent : UmbracoComponentBase, IUmbracoCoreComponent { public void Initialize(ILogger logger) { diff --git a/src/Umbraco.Web/Strategies/DatabaseServerRegistrationComponent.cs b/src/Umbraco.Web/Strategies/DatabaseServerRegistrarAndMessengerComponent.cs similarity index 63% rename from src/Umbraco.Web/Strategies/DatabaseServerRegistrationComponent.cs rename to src/Umbraco.Web/Strategies/DatabaseServerRegistrarAndMessengerComponent.cs index bf989f0d27..0de0d6f129 100644 --- a/src/Umbraco.Web/Strategies/DatabaseServerRegistrationComponent.cs +++ b/src/Umbraco.Web/Strategies/DatabaseServerRegistrarAndMessengerComponent.cs @@ -1,11 +1,17 @@ using System; +using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; +using Examine; using Umbraco.Core; using Umbraco.Core.Components; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Services; +using Umbraco.Core.Services.Changes; using Umbraco.Core.Sync; +using Umbraco.Web.Cache; using Umbraco.Web.Routing; using Umbraco.Web.Scheduling; @@ -22,7 +28,8 @@ namespace Umbraco.Web.Strategies /// out the "server address" ie the address to which server-to-server requests should be sent - because it /// probably is not the "current request address" - especially in multi-domains configurations. /// - public sealed class DatabaseServerRegistrationComponent : UmbracoComponentBase, IUmbracoCoreComponent + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] + public sealed class DatabaseServerRegistrarAndMessengerComponent : UmbracoComponentBase, IUmbracoCoreComponent { private object _locker = new object(); private DatabaseServerRegistrar _registrar; @@ -33,12 +40,66 @@ namespace Umbraco.Web.Strategies private bool _started; private TouchServerTask _task; + public override void Compose(Composition composition) + { + if (UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled) return; + + composition.SetServerMessenger(factory => + { + var runtime = factory.GetInstance(); + var databaseContext = factory.GetInstance(); + var logger = factory.GetInstance(); + var proflog = factory.GetInstance(); + + return new BatchedDatabaseServerMessenger( + runtime, databaseContext, logger, proflog, + true, + //Default options for web including the required callbacks to build caches + new DatabaseServerMessengerOptions + { + //These callbacks will be executed if the server has not been synced + // (i.e. it is a new server or the lastsynced.txt file has been removed) + InitializingCallbacks = new Action[] + { + //rebuild the xml cache file if the server is not synced + () => + { + // rebuild the facade caches entirely, if the server is not synced + // this is equivalent to DistributedCache RefreshAllFacade but local only + // (we really should have a way to reuse RefreshAllFacade... locally) + // note: refresh all content & media caches does refresh content types too + var svc = Current.FacadeService; + bool ignored1, ignored2; + svc.Notify(new[] { new DomainCacheRefresher.JsonPayload(0, DomainChangeTypes.RefreshAll) }); + svc.Notify(new[] { new ContentCacheRefresher.JsonPayload(0, TreeChangeTypes.RefreshAll) }, out ignored1, out ignored2); + svc.Notify(new[] { new MediaCacheRefresher.JsonPayload(0, TreeChangeTypes.RefreshAll) }, out ignored1); + }, + + //rebuild indexes if the server is not synced + // NOTE: This will rebuild ALL indexes including the members, if developers want to target specific + // indexes then they can adjust this logic themselves. + () => RebuildIndexes(false) + } + }); + }); + } + + // fixme - this should move to something else, we should not depend on Examine here! + private static void RebuildIndexes(bool onlyEmptyIndexes) + { + var indexers = (IEnumerable>) ExamineManager.Instance.IndexProviders; + if (onlyEmptyIndexes) + indexers = indexers.Where(x => x.Value.IsIndexNew()); + foreach (var indexer in indexers) + indexer.Value.RebuildIndex(); + } + public void Initialize(IRuntimeState runtime, IServerRegistrar serverRegistrar, IServerRegistrationService registrationService, ILogger logger) { - _registrar = serverRegistrar as DatabaseServerRegistrar; + if (UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled) return; - // only for the DatabaseServerRegistrar - if (_registrar == null) return; + _registrar = serverRegistrar as DatabaseServerRegistrar; + if (_registrar == null) throw new Exception("panic: registar."); _runtime = runtime; _logger = logger; @@ -144,7 +205,7 @@ namespace Umbraco.Web.Strategies } catch (Exception ex) { - _logger.Error("Failed to update server record in database.", ex); + _logger.Error("Failed to update server record in database.", ex); return false; // probably stop if we have an error } } diff --git a/src/Umbraco.Web/Strategies/LegacyServerRegistrarAndMessengerComponent.cs b/src/Umbraco.Web/Strategies/LegacyServerRegistrarAndMessengerComponent.cs new file mode 100644 index 0000000000..4beba23613 --- /dev/null +++ b/src/Umbraco.Web/Strategies/LegacyServerRegistrarAndMessengerComponent.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Umbraco.Core; +using Umbraco.Core.Components; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Services; + +namespace Umbraco.Web.Strategies +{ + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] + public sealed class LegacyServerRegistrarAndMessengerComponent : UmbracoComponentBase, IUmbracoCoreComponent + { + public override void Compose(Composition composition) + { + if (UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled == false) return; + + composition.SetServerMessenger(factory => + { + var runtime = factory.GetInstance(); + var logger = factory.GetInstance(); + var userService = factory.GetInstance(); + + return new BatchedWebServiceServerMessenger(() => + { + // we should not proceed to change this if the app/database is not configured since there will + // be no user, plus we don't need to have server messages sent if this is the case. + if (runtime.Level == RuntimeLevel.Run) + { + try + { + var user = userService.GetUserById(UmbracoConfig.For.UmbracoSettings().DistributedCall.UserId); + return Tuple.Create(user.Username, user.RawPasswordValue); + } + catch (Exception e) + { + logger.Error("An error occurred trying to set the IServerMessenger during application startup", e); + return null; + } + } + logger.Warn("Could not initialize the DefaultServerMessenger, the application is not configured or the database is not configured"); + return null; + }); + }); + } + } +} diff --git a/src/Umbraco.Web/Strategies/Migrations/PostMigrationCollection.cs b/src/Umbraco.Web/Strategies/Migrations/PostMigrationCollection.cs index 58c04e44e3..948024b8aa 100644 --- a/src/Umbraco.Web/Strategies/Migrations/PostMigrationCollection.cs +++ b/src/Umbraco.Web/Strategies/Migrations/PostMigrationCollection.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Strategies.Migrations { diff --git a/src/Umbraco.Web/Strategies/Migrations/PostMigrationCollectionBuilder.cs b/src/Umbraco.Web/Strategies/Migrations/PostMigrationCollectionBuilder.cs index 63683c1edb..f6d775ed0a 100644 --- a/src/Umbraco.Web/Strategies/Migrations/PostMigrationCollectionBuilder.cs +++ b/src/Umbraco.Web/Strategies/Migrations/PostMigrationCollectionBuilder.cs @@ -1,5 +1,5 @@ using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.Strategies.Migrations { diff --git a/src/Umbraco.Web/Strategies/Migrations/PostMigrationComponent.cs b/src/Umbraco.Web/Strategies/Migrations/PostMigrationComponent.cs index 026e81370b..ec984a7259 100644 --- a/src/Umbraco.Web/Strategies/Migrations/PostMigrationComponent.cs +++ b/src/Umbraco.Web/Strategies/Migrations/PostMigrationComponent.cs @@ -1,5 +1,5 @@ -using LightInject; -using Umbraco.Core.Components; +using Umbraco.Core.Components; +using Umbraco.Core.DI; using Umbraco.Core.Persistence.Migrations; using Umbraco.Core.Plugins; @@ -7,9 +7,9 @@ namespace Umbraco.Web.Strategies.Migrations { public class PostMigrationComponent : UmbracoComponentBase, IUmbracoCoreComponent { - public override void Compose(ServiceContainer container) + public override void Compose(Composition composition) { - PostMigrationCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Add(factory => factory.GetInstance().ResolveTypes()); } @@ -21,4 +21,14 @@ namespace Umbraco.Web.Strategies.Migrations MigrationRunner.Migrated += post.Migrated; } } + + public static class PostMigrationComponentCompositionExtensions + { + /// + /// Gets the post-migrations collection builder. + /// + /// The composition. + internal static PostMigrationCollectionBuilder PostMigrations(this Composition composition) + => composition.Container.GetInstance(); + } } \ No newline at end of file diff --git a/src/Umbraco.Web/Strategies/NotificationsComponent.cs b/src/Umbraco.Web/Strategies/NotificationsComponent.cs index b6e2291f39..322e0db355 100644 --- a/src/Umbraco.Web/Strategies/NotificationsComponent.cs +++ b/src/Umbraco.Web/Strategies/NotificationsComponent.cs @@ -8,6 +8,7 @@ using Umbraco.Core.Models; namespace Umbraco.Web.Strategies { + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] public sealed class NotificationsComponent : UmbracoComponentBase, IUmbracoCoreComponent { public void Initialize(INotificationService notificationService) diff --git a/src/Umbraco.Web/Strategies/PublicAccessComponent.cs b/src/Umbraco.Web/Strategies/PublicAccessComponent.cs index 3dcb723cd9..b8443f7730 100644 --- a/src/Umbraco.Web/Strategies/PublicAccessComponent.cs +++ b/src/Umbraco.Web/Strategies/PublicAccessComponent.cs @@ -7,6 +7,7 @@ namespace Umbraco.Web.Strategies /// /// Used to ensure that the public access data file is kept up to date properly /// + [RuntimeLevel(MinLevel = RuntimeLevel.Run)] public sealed class PublicAccessComponent : UmbracoComponentBase, IUmbracoCoreComponent { public void Initialize() diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 6091433e57..e7e6e9eaca 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -159,6 +159,7 @@ + @@ -277,6 +278,7 @@ + @@ -989,7 +991,7 @@ - + diff --git a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs index c08ec09ad8..affb9fb0d4 100644 --- a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs +++ b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs @@ -30,7 +30,7 @@ namespace Umbraco.Web app.SanitizeThreadCulture(); // there's nothing we can do really - if (Core.DependencyInjection.Current.RuntimeState.Level == RuntimeLevel.BootFailed) + if (Core.DI.Current.RuntimeState.Level == RuntimeLevel.BootFailed) return; ConfigureServices(app, Current.Services); diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs index 67e58c226b..94b9768f70 100644 --- a/src/Umbraco.Web/UmbracoModule.cs +++ b/src/Umbraco.Web/UmbracoModule.cs @@ -483,7 +483,7 @@ namespace Umbraco.Web /// public void Init(HttpApplication app) { - if (Core.DependencyInjection.Current.RuntimeState.Level == RuntimeLevel.BootFailed) + if (Core.DI.Current.RuntimeState.Level == RuntimeLevel.BootFailed) { // there's nothing we can do really app.BeginRequest += (sender, args) => { throw new BootFailedException("Boot failed. Umbraco cannot run. Umbraco's log file contains details about what caused the boot to fail."); }; @@ -492,7 +492,7 @@ namespace Umbraco.Web // modules are *not* instanciated by the container so we have to // get our dependencies injected manually, through properties. - Core.DependencyInjection.Current.Container.InjectProperties(this); + Core.DI.Current.Container.InjectProperties(this); app.BeginRequest += (sender, e) => { diff --git a/src/Umbraco.Web/WebApi/UmbracoApiControllerTypeCollection.cs b/src/Umbraco.Web/WebApi/UmbracoApiControllerTypeCollection.cs index 9cfc197497..dcb2f7df63 100644 --- a/src/Umbraco.Web/WebApi/UmbracoApiControllerTypeCollection.cs +++ b/src/Umbraco.Web/WebApi/UmbracoApiControllerTypeCollection.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace Umbraco.Web.WebApi { diff --git a/src/Umbraco.Web/WebRuntime.cs b/src/Umbraco.Web/WebRuntime.cs index 2065f443ca..9d9049e14f 100644 --- a/src/Umbraco.Web/WebRuntime.cs +++ b/src/Umbraco.Web/WebRuntime.cs @@ -4,7 +4,7 @@ using LightInject; using Umbraco.Core; using Umbraco.Core.Logging; using Umbraco.Core.Cache; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Persistence; namespace Umbraco.Web diff --git a/src/Umbraco.Web/WebRuntimeComponent.cs b/src/Umbraco.Web/WebRuntimeComponent.cs index 68299ccf14..42488a9466 100644 --- a/src/Umbraco.Web/WebRuntimeComponent.cs +++ b/src/Umbraco.Web/WebRuntimeComponent.cs @@ -15,7 +15,7 @@ using LightInject; using Umbraco.Core; using Umbraco.Core.Components; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Dictionary; using Umbraco.Core.Events; using Umbraco.Core.Logging; @@ -25,9 +25,6 @@ using Umbraco.Core.Profiling; using Umbraco.Core.PropertyEditors; using Umbraco.Core.PropertyEditors.ValueConverters; using Umbraco.Core.Services; -using Umbraco.Core.Services.Changes; -using Umbraco.Core.Sync; -using Umbraco.Web.Cache; using Umbraco.Web.DependencyInjection; using Umbraco.Web.Dictionary; using Umbraco.Web.Editors; @@ -44,98 +41,89 @@ using Umbraco.Web.UI.JavaScript; using Umbraco.Web.WebApi; using Umbraco.Web._Legacy.Actions; using UmbracoExamine; -using Action = System.Action; namespace Umbraco.Web { [RequireComponent(typeof(CoreRuntimeComponent))] public class WebRuntimeComponent : UmbracoComponentBase, IRuntimeComponent { - public override void Compose(ServiceContainer container, RuntimeLevel runtimeLevel) + public override void Compose(Composition composition) { - base.Compose(container); + base.Compose(composition); - container.RegisterFrom(); + composition.Container.RegisterFrom(); - var pluginManager = container.GetInstance(); - var logger = container.GetInstance(); - var proflog = container.GetInstance(); + var pluginManager = composition.Container.GetInstance(); + var logger = composition.Container.GetInstance(); + var proflog = composition.Container.GetInstance(); // register the http context and umbraco context accessors // we *should* use the HttpContextUmbracoContextAccessor, however there are cases when // we have no http context, eg when booting Umbraco or in background threads, so instead // let's use an hybrid accessor that can fall back to a ThreadStatic context. - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); // register the 'current' umbraco context - transient - for eg controllers - container.Register(factory => factory.GetInstance().UmbracoContext); + composition.Container.Register(factory => factory.GetInstance().UmbracoContext); // register a per-request HttpContextBase object // is per-request so only one wrapper is created per request - container.Register(factory => new HttpContextWrapper(factory.GetInstance().HttpContext), new PerRequestLifeTime()); + composition.Container.Register(factory => new HttpContextWrapper(factory.GetInstance().HttpContext), new PerRequestLifeTime()); // register the facade accessor - the "current" facade is in the umbraco context - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); // register a per-request UmbracoContext object // no real need to be per request but assuming it is faster - container.Register(factory => factory.GetInstance().UmbracoContext, new PerRequestLifeTime()); + composition.Container.Register(factory => factory.GetInstance().UmbracoContext, new PerRequestLifeTime()); // register the umbraco helper // fixme - FUCK! how can this even work, it's not a singleton! - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); // replace some services - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); + composition.Container.RegisterSingleton(); + composition.Container.RegisterSingleton(); + composition.Container.RegisterSingleton(); - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); // IoC setup for LightInject for MVC/WebApi // see comments on MixedScopeManagerProvider for explainations of what we are doing here - var smp = container.ScopeManagerProvider as MixedScopeManagerProvider; + var smp = composition.Container.ScopeManagerProvider as MixedScopeManagerProvider; if (smp == null) throw new Exception("Container.ScopeManagerProvider is not MixedScopeManagerProvider."); - container.EnableMvc(); // does container.EnablePerWebRequestScope() - container.ScopeManagerProvider = smp; // reverts - we will do it last (in WebRuntime) + composition.Container.EnableMvc(); // does container.EnablePerWebRequestScope() + composition.Container.ScopeManagerProvider = smp; // reverts - we will do it last (in WebRuntime) - container.RegisterMvcControllers(pluginManager, GetType().Assembly); - container.EnableWebApi(GlobalConfiguration.Configuration); - container.RegisterApiControllers(pluginManager, GetType().Assembly); + composition.Container.RegisterMvcControllers(pluginManager, GetType().Assembly); + composition.Container.EnableWebApi(GlobalConfiguration.Configuration); + composition.Container.RegisterApiControllers(pluginManager, GetType().Assembly); - XsltExtensionCollectionBuilder.Register(container) + XsltExtensionCollectionBuilder.Register(composition.Container) .AddExtensionObjectProducer(() => pluginManager.ResolveXsltExtensions()); - EditorValidatorCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Add(() => pluginManager.ResolveTypes()); // set the default RenderMvcController Current.DefaultRenderMvcControllerType = typeof(RenderMvcController); // fixme WRONG! - // override the default server messenger, we need to check if the legacy dist calls is enabled, if that is the - // case, then we'll set the default messenger to be the old one, otherwise we'll set it to the db messenger - // which will always be on. - if (UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled) - ComposeLegacyMessenger(container, runtimeLevel, logger); - else - ComposeMessenger(container, logger, proflog); - - ActionCollectionBuilder.Register(container) + ActionCollectionBuilder.Register(composition.Container) .SetProducer(() => pluginManager.ResolveActions()); var surfaceControllerTypes = new SurfaceControllerTypeCollection(pluginManager.ResolveSurfaceControllers()); - container.RegisterInstance(surfaceControllerTypes); + composition.Container.RegisterInstance(surfaceControllerTypes); var umbracoApiControllerTypes = new UmbracoApiControllerTypeCollection(pluginManager.ResolveUmbracoApiControllers()); - container.RegisterInstance(umbracoApiControllerTypes); + composition.Container.RegisterInstance(umbracoApiControllerTypes); // both TinyMceValueConverter (in Core) and RteMacroRenderingValueConverter (in Web) will be // discovered when CoreBootManager configures the converters. We HAVE to remove one of them // here because there cannot be two converters for one property editor - and we want the full // RteMacroRenderingValueConverter that converts macros, etc. So remove TinyMceValueConverter. // (the limited one, defined in Core, is there for tests) - same for others - container.GetInstance() + composition.Container.GetInstance() .Remove() .Remove() .Remove() @@ -143,17 +131,17 @@ namespace Umbraco.Web // add all known factories, devs can then modify this list on application // startup either by binding to events or in their own global.asax - FilteredControllerFactoryCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Append(); - UrlProviderCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder < UrlProviderCollectionBuilder>() //.Append() // not enabled by default .Append() .Append(); - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); - ContentFinderCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder < ContentFinderCollectionBuilder>() // all built-in finders in the correct order, // devs can then modify this list on application startup .Append() @@ -164,89 +152,22 @@ namespace Umbraco.Web .Append() .Append(); - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); - ThumbnailProviderCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Add(pluginManager.ResolveThumbnailProviders()); - ImageUrlProviderCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Append(pluginManager.ResolveImageUrlProviders()); - container.RegisterSingleton(); + composition.Container.RegisterSingleton(); // register *all* checks, except those marked [HideFromTypeFinder] of course - HealthCheckCollectionBuilder.Register(container) + composition.Container.RegisterCollectionBuilder() .Add(() => pluginManager.ResolveTypes()); // auto-register views - container.RegisterAuto(typeof(UmbracoViewPage<>)); - } - - private static void ComposeLegacyMessenger(IServiceRegistry container, RuntimeLevel runtimeLevel, ILogger logger) - { - //set the legacy one by default - this maintains backwards compat - container.Register(factory => - { - var userService = factory.GetInstance(); - return new BatchedWebServiceServerMessenger(() => - { - // we should not proceed to change this if the app/database is not configured since there will - // be no user, plus we don't need to have server messages sent if this is the case. - if (runtimeLevel == RuntimeLevel.Run) - { - try - { - var user = userService.GetUserById(UmbracoConfig.For.UmbracoSettings().DistributedCall.UserId); - return Tuple.Create(user.Username, user.RawPasswordValue); - } - catch (Exception e) - { - logger.Error("An error occurred trying to set the IServerMessenger during application startup", e); - return null; - } - } - logger.Warn("Could not initialize the DefaultServerMessenger, the application is not configured or the database is not configured"); - return null; - }); - }, new PerContainerLifetime()); - } - - private static void ComposeMessenger(IServiceRegistry container, ILogger logger, ProfilingLogger proflog) - { - container.Register(factory => - { - var runtime = factory.GetInstance(); - var databaseContext = factory.GetInstance(); - return new BatchedDatabaseServerMessenger( - runtime, databaseContext, logger, proflog, - true, - //Default options for web including the required callbacks to build caches - new DatabaseServerMessengerOptions - { - //These callbacks will be executed if the server has not been synced - // (i.e. it is a new server or the lastsynced.txt file has been removed) - InitializingCallbacks = new Action[] - { - //rebuild the xml cache file if the server is not synced - () => - { - // rebuild the facade caches entirely, if the server is not synced - // this is equivalent to DistributedCache RefreshAllFacade but local only - // (we really should have a way to reuse RefreshAllFacade... locally) - // note: refresh all content & media caches does refresh content types too - var svc = Current.FacadeService; - bool ignored1, ignored2; - svc.Notify(new[] { new DomainCacheRefresher.JsonPayload(0, DomainChangeTypes.RefreshAll) }); - svc.Notify(new[] { new ContentCacheRefresher.JsonPayload(0, TreeChangeTypes.RefreshAll) }, out ignored1, out ignored2); - svc.Notify(new[] { new MediaCacheRefresher.JsonPayload(0, TreeChangeTypes.RefreshAll) }, out ignored1); - }, - //rebuild indexes if the server is not synced - // NOTE: This will rebuild ALL indexes including the members, if developers want to target specific - // indexes then they can adjust this logic themselves. - () => RebuildIndexes(false) - } - }); - }, new PerContainerLifetime()); + composition.Container.RegisterAuto(typeof(UmbracoViewPage<>)); } internal void Initialize( @@ -317,9 +238,10 @@ namespace Umbraco.Web GlobalConfiguration.Configuration.EnsureInitialized(); } + // fixme - this should move to something else, we should not depend on Examine here! private static void RebuildIndexes(bool onlyEmptyIndexes) { - var indexers = (IEnumerable>) ExamineManager.Instance.IndexProviders; + var indexers = (IEnumerable>)ExamineManager.Instance.IndexProviders; if (onlyEmptyIndexes) indexers = indexers.Where(x => x.Value.IsIndexNew()); foreach (var indexer in indexers) diff --git a/src/Umbraco.Web/_Legacy/Actions/ActionAssignDomain.cs b/src/Umbraco.Web/_Legacy/Actions/ActionAssignDomain.cs index da0b0f1c45..c9b6bc1ace 100644 --- a/src/Umbraco.Web/_Legacy/Actions/ActionAssignDomain.cs +++ b/src/Umbraco.Web/_Legacy/Actions/ActionAssignDomain.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using LightInject; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Web.UI.Pages; namespace Umbraco.Web._Legacy.Actions diff --git a/src/UmbracoExamine/BaseUmbracoIndexer.cs b/src/UmbracoExamine/BaseUmbracoIndexer.cs index e4836f6357..5365d992a5 100644 --- a/src/UmbracoExamine/BaseUmbracoIndexer.cs +++ b/src/UmbracoExamine/BaseUmbracoIndexer.cs @@ -18,7 +18,7 @@ using Examine.LuceneEngine.Faceting; using Examine.LuceneEngine.Indexing; using Lucene.Net.Documents; using Lucene.Net.Store; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Xml; using UmbracoExamine.LocalStorage; diff --git a/src/UmbracoExamine/LocalStorage/LocalTempStorageIndexer.cs b/src/UmbracoExamine/LocalStorage/LocalTempStorageIndexer.cs index e15144d5ad..689a0bc556 100644 --- a/src/UmbracoExamine/LocalStorage/LocalTempStorageIndexer.cs +++ b/src/UmbracoExamine/LocalStorage/LocalTempStorageIndexer.cs @@ -10,7 +10,7 @@ using Lucene.Net.Analysis; using Lucene.Net.Index; using Lucene.Net.Store; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Directory = System.IO.Directory; diff --git a/src/UmbracoExamine/UmbracoContentIndexer.cs b/src/UmbracoExamine/UmbracoContentIndexer.cs index 2bfdb158b9..e562e38497 100644 --- a/src/UmbracoExamine/UmbracoContentIndexer.cs +++ b/src/UmbracoExamine/UmbracoContentIndexer.cs @@ -13,7 +13,7 @@ using Examine.LuceneEngine.Indexing; using Examine.LuceneEngine.Providers; using Lucene.Net.Analysis; using Lucene.Net.Store; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.Persistence.DatabaseModelDefinitions; using Umbraco.Core.Persistence.Querying; diff --git a/src/UmbracoExamine/UmbracoExamineSearcher.cs b/src/UmbracoExamine/UmbracoExamineSearcher.cs index 9a0f1df158..477b9b4947 100644 --- a/src/UmbracoExamine/UmbracoExamineSearcher.cs +++ b/src/UmbracoExamine/UmbracoExamineSearcher.cs @@ -16,7 +16,7 @@ using Examine.LuceneEngine; using Examine.LuceneEngine.Providers; using Examine.LuceneEngine.SearchCriteria; using Lucene.Net.Analysis; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using UmbracoExamine.LocalStorage; using Directory = Lucene.Net.Store.Directory; diff --git a/src/UmbracoExamine/UmbracoMemberIndexer.cs b/src/UmbracoExamine/UmbracoMemberIndexer.cs index 7d37085af2..6356941950 100644 --- a/src/UmbracoExamine/UmbracoMemberIndexer.cs +++ b/src/UmbracoExamine/UmbracoMemberIndexer.cs @@ -13,7 +13,7 @@ using Examine; using System.IO; using Examine.LuceneEngine.Providers; using Lucene.Net.Analysis; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Directory = Lucene.Net.Store.Directory; diff --git a/src/umbraco.cms/businesslogic/CMSNode.cs b/src/umbraco.cms/businesslogic/CMSNode.cs index a7e5afce1f..85139907b2 100644 --- a/src/umbraco.cms/businesslogic/CMSNode.cs +++ b/src/umbraco.cms/businesslogic/CMSNode.cs @@ -16,7 +16,7 @@ using System.ComponentModel; using Umbraco.Core.IO; using System.Collections; using umbraco.cms.businesslogic.task; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; using File = System.IO.File; diff --git a/src/umbraco.cms/businesslogic/Content.cs b/src/umbraco.cms/businesslogic/Content.cs index 8d06710d00..78b0dda3c9 100644 --- a/src/umbraco.cms/businesslogic/Content.cs +++ b/src/umbraco.cms/businesslogic/Content.cs @@ -9,7 +9,7 @@ using Umbraco.Core.Models; using Umbraco.Core.Models.EntityBase; using umbraco.DataLayer; using System.Runtime.CompilerServices; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Events; using Umbraco.Core.Persistence; using File = System.IO.File; diff --git a/src/umbraco.cms/businesslogic/ContentType.cs b/src/umbraco.cms/businesslogic/ContentType.cs index 9ad7f0c6fc..a062ca91cc 100644 --- a/src/umbraco.cms/businesslogic/ContentType.cs +++ b/src/umbraco.cms/businesslogic/ContentType.cs @@ -11,7 +11,7 @@ using Umbraco.Core.Models.Rdbms; using umbraco.cms.businesslogic.propertytype; using umbraco.cms.businesslogic.web; using umbraco.DataLayer; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Language = umbraco.cms.businesslogic.language.Language; using PropertyType = umbraco.cms.businesslogic.propertytype.PropertyType; diff --git a/src/umbraco.cms/businesslogic/LegacySqlHelper.cs b/src/umbraco.cms/businesslogic/LegacySqlHelper.cs index 614b1f04d9..9f0b1ded7f 100644 --- a/src/umbraco.cms/businesslogic/LegacySqlHelper.cs +++ b/src/umbraco.cms/businesslogic/LegacySqlHelper.cs @@ -2,7 +2,7 @@ using System; using System.Configuration; using umbraco.DataLayer; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace umbraco.cms.businesslogic diff --git a/src/umbraco.cms/businesslogic/Packager/Installer.cs b/src/umbraco.cms/businesslogic/Packager/Installer.cs index 69cd0674bb..ccbb74239e 100644 --- a/src/umbraco.cms/businesslogic/Packager/Installer.cs +++ b/src/umbraco.cms/businesslogic/Packager/Installer.cs @@ -13,7 +13,7 @@ using umbraco.cms.businesslogic.web; using System.Diagnostics; using Umbraco.Core.Models; using System.Security; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Xml; using File = System.IO.File; using Macro = umbraco.cms.businesslogic.macro.Macro; diff --git a/src/umbraco.cms/businesslogic/Packager/Package.cs b/src/umbraco.cms/businesslogic/Packager/Package.cs index a4c75e8f35..0ab43a3f13 100644 --- a/src/umbraco.cms/businesslogic/Packager/Package.cs +++ b/src/umbraco.cms/businesslogic/Packager/Package.cs @@ -4,7 +4,7 @@ using System.Runtime.CompilerServices; using umbraco.BusinessLogic; using umbraco.DataLayer; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; namespace umbraco.cms.businesslogic.packager diff --git a/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs b/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs index 7a091f4050..24a2f513f0 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs @@ -11,7 +11,7 @@ using Umbraco.Core; using Umbraco.Core.Logging; using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic.macro; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.Services; diff --git a/src/umbraco.cms/businesslogic/Packager/PackageInstance/InstalledPackage.cs b/src/umbraco.cms/businesslogic/Packager/PackageInstance/InstalledPackage.cs index 8d3dc8abd4..b6e8e9ddd1 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageInstance/InstalledPackage.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageInstance/InstalledPackage.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.IO; using Umbraco.Core.Models; diff --git a/src/umbraco.cms/businesslogic/Packager/PackageInstance/PackageActions.cs b/src/umbraco.cms/businesslogic/Packager/PackageInstance/PackageActions.cs index bfc902923d..a607dd3164 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageInstance/PackageActions.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageInstance/PackageActions.cs @@ -1,7 +1,7 @@ using System; using System.Xml; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core._Legacy.PackageActions; diff --git a/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs b/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs index d5accf0fe4..27c70fc325 100644 --- a/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs +++ b/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs @@ -7,7 +7,7 @@ using System.IO; using System.Net; using Umbraco.Core; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; using Umbraco.Core.IO; using Umbraco.Core.Models; diff --git a/src/umbraco.cms/businesslogic/Packager/data.cs b/src/umbraco.cms/businesslogic/Packager/data.cs index 96e1df603c..475443b044 100644 --- a/src/umbraco.cms/businesslogic/Packager/data.cs +++ b/src/umbraco.cms/businesslogic/Packager/data.cs @@ -6,7 +6,7 @@ using System.ComponentModel; using System.IO; using Umbraco.Core; using Umbraco.Core.Configuration; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Xml; diff --git a/src/umbraco.cms/businesslogic/Permission.cs b/src/umbraco.cms/businesslogic/Permission.cs index dc8663b943..0cdc8d73ad 100644 --- a/src/umbraco.cms/businesslogic/Permission.cs +++ b/src/umbraco.cms/businesslogic/Permission.cs @@ -3,7 +3,7 @@ using Umbraco.Core; using Umbraco.Core.Events; using umbraco.cms.businesslogic; using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; using Umbraco.Core.Services; diff --git a/src/umbraco.cms/businesslogic/language/Item.cs b/src/umbraco.cms/businesslogic/language/Item.cs index e50758c1ff..6fb0e4b9e5 100644 --- a/src/umbraco.cms/businesslogic/language/Item.cs +++ b/src/umbraco.cms/businesslogic/language/Item.cs @@ -12,7 +12,7 @@ using Umbraco.Core.Persistence.SqlSyntax; using umbraco.DataLayer; using umbraco.BusinessLogic; using System.Collections.Generic; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Rdbms; namespace umbraco.cms.businesslogic.language diff --git a/src/umbraco.cms/businesslogic/language/Language.cs b/src/umbraco.cms/businesslogic/language/Language.cs index b0010b0469..34f4ebeaf2 100644 --- a/src/umbraco.cms/businesslogic/language/Language.cs +++ b/src/umbraco.cms/businesslogic/language/Language.cs @@ -12,7 +12,7 @@ using Umbraco.Core.Services; using umbraco.DataLayer; using umbraco.BusinessLogic; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace umbraco.cms.businesslogic.language { diff --git a/src/umbraco.cms/businesslogic/macro/Macro.cs b/src/umbraco.cms/businesslogic/macro/Macro.cs index 0a3f49887a..39a7367bc1 100644 --- a/src/umbraco.cms/businesslogic/macro/Macro.cs +++ b/src/umbraco.cms/businesslogic/macro/Macro.cs @@ -15,7 +15,7 @@ using Umbraco.Core.Services; using umbraco.DataLayer; using umbraco.BusinessLogic; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Xml; namespace umbraco.cms.businesslogic.macro diff --git a/src/umbraco.cms/businesslogic/media/Media.cs b/src/umbraco.cms/businesslogic/media/Media.cs index cabb09a4a1..1263682afa 100644 --- a/src/umbraco.cms/businesslogic/media/Media.cs +++ b/src/umbraco.cms/businesslogic/media/Media.cs @@ -9,7 +9,7 @@ using System.Collections; using System.Collections.Generic; using System.Xml; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; namespace umbraco.cms.businesslogic.media diff --git a/src/umbraco.cms/businesslogic/media/MediaType.cs b/src/umbraco.cms/businesslogic/media/MediaType.cs index 2f673ee1e7..d46985a566 100644 --- a/src/umbraco.cms/businesslogic/media/MediaType.cs +++ b/src/umbraco.cms/businesslogic/media/MediaType.cs @@ -4,7 +4,7 @@ using Umbraco.Core; using Umbraco.Core.Models; using System.Linq; using System.Threading; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; using Umbraco.Core.Security; diff --git a/src/umbraco.cms/businesslogic/member/Member.cs b/src/umbraco.cms/businesslogic/member/Member.cs index 0be1ed690e..7bf4bee73b 100644 --- a/src/umbraco.cms/businesslogic/member/Member.cs +++ b/src/umbraco.cms/businesslogic/member/Member.cs @@ -16,7 +16,7 @@ using System.Web.Security; using System.Text; using System.Security.Cryptography; using System.Linq; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; using Umbraco.Core.Security; using Umbraco.Core.Xml; diff --git a/src/umbraco.cms/businesslogic/member/MemberType.cs b/src/umbraco.cms/businesslogic/member/MemberType.cs index 33c732cec2..1ff779de80 100644 --- a/src/umbraco.cms/businesslogic/member/MemberType.cs +++ b/src/umbraco.cms/businesslogic/member/MemberType.cs @@ -1,7 +1,7 @@ using System; using System.Linq; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Events; using Umbraco.Core.Models; using Umbraco.Core.Models.Membership; diff --git a/src/umbraco.cms/businesslogic/propertytype/propertytype.cs b/src/umbraco.cms/businesslogic/propertytype/propertytype.cs index d1b12aadf2..926fa3fa2e 100644 --- a/src/umbraco.cms/businesslogic/propertytype/propertytype.cs +++ b/src/umbraco.cms/businesslogic/propertytype/propertytype.cs @@ -10,7 +10,7 @@ using Umbraco.Core.Models; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.web; using umbraco.DataLayer; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Language = umbraco.cms.businesslogic.language.Language; namespace umbraco.cms.businesslogic.propertytype diff --git a/src/umbraco.cms/businesslogic/task/Task.cs b/src/umbraco.cms/businesslogic/task/Task.cs index 0f97dbc4bc..e64c536987 100644 --- a/src/umbraco.cms/businesslogic/task/Task.cs +++ b/src/umbraco.cms/businesslogic/task/Task.cs @@ -2,7 +2,7 @@ using System; using umbraco.BusinessLogic; using Umbraco.Core; using umbraco.DataLayer; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; namespace umbraco.cms.businesslogic.task diff --git a/src/umbraco.cms/businesslogic/task/TaskType.cs b/src/umbraco.cms/businesslogic/task/TaskType.cs index 34261a903f..755665865a 100644 --- a/src/umbraco.cms/businesslogic/task/TaskType.cs +++ b/src/umbraco.cms/businesslogic/task/TaskType.cs @@ -8,7 +8,7 @@ using System.Runtime.CompilerServices; using umbraco.BusinessLogic; using Umbraco.Core; using umbraco.DataLayer; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; namespace umbraco.cms.businesslogic.task diff --git a/src/umbraco.cms/businesslogic/template/Template.cs b/src/umbraco.cms/businesslogic/template/Template.cs index a6a9095c70..85dcfadfe4 100644 --- a/src/umbraco.cms/businesslogic/template/Template.cs +++ b/src/umbraco.cms/businesslogic/template/Template.cs @@ -10,7 +10,7 @@ using Umbraco.Core.Services; using System.Text.RegularExpressions; using System.Collections.Generic; using umbraco.cms.businesslogic.web; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; using Umbraco.Core.Xml; diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs index 2f0ffaa823..b1cf8d8951 100644 --- a/src/umbraco.cms/businesslogic/web/Document.cs +++ b/src/umbraco.cms/businesslogic/web/Document.cs @@ -6,7 +6,7 @@ using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.EntityBase; using umbraco.DataLayer; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; namespace umbraco.cms.businesslogic.web diff --git a/src/umbraco.cms/businesslogic/web/DocumentType.cs b/src/umbraco.cms/businesslogic/web/DocumentType.cs index 79263ca962..143d348700 100644 --- a/src/umbraco.cms/businesslogic/web/DocumentType.cs +++ b/src/umbraco.cms/businesslogic/web/DocumentType.cs @@ -8,7 +8,7 @@ using umbraco.DataLayer; using System.Collections.Generic; using System.Threading; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; using Umbraco.Core.Security; diff --git a/src/umbraco.cms/businesslogic/web/Domain.cs b/src/umbraco.cms/businesslogic/web/Domain.cs index bef93ca03c..21176f4e86 100644 --- a/src/umbraco.cms/businesslogic/web/Domain.cs +++ b/src/umbraco.cms/businesslogic/web/Domain.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models; using Language = umbraco.cms.businesslogic.language.Language; diff --git a/src/umbraco.cms/businesslogic/web/StyleSheet.cs b/src/umbraco.cms/businesslogic/web/StyleSheet.cs index bed197964f..6b1e42ec9f 100644 --- a/src/umbraco.cms/businesslogic/web/StyleSheet.cs +++ b/src/umbraco.cms/businesslogic/web/StyleSheet.cs @@ -5,7 +5,7 @@ using System.Xml; using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; using Umbraco.Core.Xml; diff --git a/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs b/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs index 6412a3cfa7..0ac81e7b94 100644 --- a/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs +++ b/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs @@ -1,7 +1,7 @@ using System; using System.Linq; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Models.Membership; namespace umbraco.cms.businesslogic.web diff --git a/src/umbraco.controls/ProgressBar.cs b/src/umbraco.controls/ProgressBar.cs index 1b04c96c4d..bacca32f1d 100644 --- a/src/umbraco.controls/ProgressBar.cs +++ b/src/umbraco.controls/ProgressBar.cs @@ -1,6 +1,6 @@ using System; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Services; namespace umbraco.uicontrols diff --git a/src/umbraco.controls/TreePicker/BaseTreePicker.cs b/src/umbraco.controls/TreePicker/BaseTreePicker.cs index c9909dc296..6274df9c86 100644 --- a/src/umbraco.controls/TreePicker/BaseTreePicker.cs +++ b/src/umbraco.controls/TreePicker/BaseTreePicker.cs @@ -6,7 +6,7 @@ using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using umbraco.cms.businesslogic; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Services; namespace umbraco.uicontrols.TreePicker diff --git a/src/umbraco.controls/TreePicker/SimpleContentPicker.cs b/src/umbraco.controls/TreePicker/SimpleContentPicker.cs index 6d46e1330c..43c80be3cf 100644 --- a/src/umbraco.controls/TreePicker/SimpleContentPicker.cs +++ b/src/umbraco.controls/TreePicker/SimpleContentPicker.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Services; namespace umbraco.uicontrols.TreePicker diff --git a/src/umbraco.controls/TreePicker/SimpleMediaPicker.cs b/src/umbraco.controls/TreePicker/SimpleMediaPicker.cs index 48cdd8a1ff..6a94184885 100644 --- a/src/umbraco.controls/TreePicker/SimpleMediaPicker.cs +++ b/src/umbraco.controls/TreePicker/SimpleMediaPicker.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Umbraco.Core; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Services; namespace umbraco.uicontrols.TreePicker diff --git a/src/umbraco.datalayer/SqlHelper.cs b/src/umbraco.datalayer/SqlHelper.cs index f7b538e7f5..2d4abde7f8 100644 --- a/src/umbraco.datalayer/SqlHelper.cs +++ b/src/umbraco.datalayer/SqlHelper.cs @@ -12,7 +12,7 @@ using System.Diagnostics; using System.IO; using System.Xml; using umbraco.DataLayer.Utility; -using Umbraco.Core.DependencyInjection; +using Umbraco.Core.DI; using Umbraco.Core.Logging; namespace umbraco.DataLayer