AB#5819 - Moved composing of core/infrastructure items into CoreInitialComposer
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using Umbraco.Core.Composing;
|
||||
namespace Umbraco.Web.Actions
|
||||
{
|
||||
internal class ActionCollectionBuilder : LazyCollectionBuilderBase<ActionCollectionBuilder, ActionCollection, IAction>
|
||||
public class ActionCollectionBuilder : LazyCollectionBuilderBase<ActionCollectionBuilder, ActionCollection, IAction>
|
||||
{
|
||||
protected override ActionCollectionBuilder This => this;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
/// <param name="composition">The composition.</param>
|
||||
/// <returns></returns>
|
||||
internal static ActionCollectionBuilder Actions(this Composition composition)
|
||||
public static ActionCollectionBuilder Actions(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<ActionCollectionBuilder>();
|
||||
|
||||
/// <summary>
|
||||
@@ -45,7 +45,7 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
/// <param name="composition">The composition.</param>
|
||||
/// <returns></returns>
|
||||
internal static EditorValidatorCollectionBuilder EditorValidators(this Composition composition)
|
||||
public static EditorValidatorCollectionBuilder EditorValidators(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<EditorValidatorCollectionBuilder>();
|
||||
|
||||
/// <summary>
|
||||
@@ -81,7 +81,7 @@ namespace Umbraco.Core
|
||||
/// <param name="composition">The composition.</param>
|
||||
public static SectionCollectionBuilder Sections(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<SectionCollectionBuilder>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the components collection builder.
|
||||
/// </summary>
|
||||
|
||||
@@ -7,7 +7,7 @@ using Umbraco.Core.Models.Membership;
|
||||
|
||||
namespace Umbraco.Web.ContentApps
|
||||
{
|
||||
internal class ContentEditorContentAppFactory : IContentAppFactory
|
||||
public class ContentEditorContentAppFactory : IContentAppFactory
|
||||
{
|
||||
// see note on ContentApp
|
||||
internal const int Weight = -100;
|
||||
|
||||
@@ -10,7 +10,7 @@ using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.Web.ContentApps
|
||||
{
|
||||
internal class ListViewContentAppFactory : IContentAppFactory
|
||||
public class ListViewContentAppFactory : IContentAppFactory
|
||||
{
|
||||
// see note on ContentApp
|
||||
private const int Weight = -666;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ using Umbraco.Core.Events;
|
||||
|
||||
namespace Umbraco.Web
|
||||
{
|
||||
internal class DefaultEventMessagesFactory : IEventMessagesFactory
|
||||
public class DefaultEventMessagesFactory : IEventMessagesFactory
|
||||
{
|
||||
private readonly IEventMessagesAccessor _eventMessagesAccessor;
|
||||
|
||||
@@ -3,7 +3,7 @@ using Umbraco.Core.Events;
|
||||
|
||||
namespace Umbraco.Web
|
||||
{
|
||||
internal class HybridEventMessagesAccessor : HybridAccessorBase<EventMessages>, IEventMessagesAccessor
|
||||
public class HybridEventMessagesAccessor : HybridAccessorBase<EventMessages>, IEventMessagesAccessor
|
||||
{
|
||||
protected override string ItemKey => "Umbraco.Core.Events.HybridEventMessagesAccessor";
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using Umbraco.Web.Sections;
|
||||
|
||||
namespace Umbraco.Web.Services
|
||||
{
|
||||
internal class SectionService : ISectionService
|
||||
public class SectionService : ISectionService
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
private readonly SectionCollection _sectionCollection;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Umbraco.Web.Services
|
||||
/// <summary>
|
||||
/// Implements <see cref="ITreeService"/>.
|
||||
/// </summary>
|
||||
internal class TreeService : ITreeService
|
||||
public class TreeService : ITreeService
|
||||
{
|
||||
private readonly TreeCollection _treeCollection;
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ using Umbraco.Core.Persistence.Mappers;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Web.Media.EmbedProviders;
|
||||
using Umbraco.Web.Search;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
@@ -84,7 +86,20 @@ namespace Umbraco.Core
|
||||
public static ManifestFilterCollectionBuilder ManifestFilters(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<ManifestFilterCollectionBuilder>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the backoffice OEmbed Providers collection builder.
|
||||
/// </summary>
|
||||
/// <param name="composition">The composition.</param>
|
||||
public static EmbedProvidersCollectionBuilder OEmbedProviders(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<EmbedProvidersCollectionBuilder>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the back office searchable tree collection builder
|
||||
/// </summary>
|
||||
/// <param name="composition"></param>
|
||||
/// <returns></returns>
|
||||
public static SearchableTreeCollectionBuilder SearchableTrees(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<SearchableTreeCollectionBuilder>();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -98,7 +113,7 @@ namespace Umbraco.Core
|
||||
public static void SetCultureDictionaryFactory<T>(this Composition composition)
|
||||
where T : ICultureDictionaryFactory
|
||||
{
|
||||
composition.RegisterUnique<ICultureDictionaryFactory, T>();
|
||||
composition.RegisterUnique<ICultureDictionaryFactory, T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Examine;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Composing.CompositionExtensions;
|
||||
@@ -7,9 +8,11 @@ using Umbraco.Core.Configuration.Grid;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Dashboards;
|
||||
using Umbraco.Core.Dictionary;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Manifest;
|
||||
using Umbraco.Core.Media;
|
||||
using Umbraco.Core.Migrations;
|
||||
using Umbraco.Core.Migrations.Install;
|
||||
using Umbraco.Core.Migrations.PostMigrations;
|
||||
@@ -17,19 +20,35 @@ using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.PropertyEditors.Validators;
|
||||
using Umbraco.Core.PropertyEditors.ValueConverters;
|
||||
using Umbraco.Core.Scoping;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Implement;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Examine;
|
||||
using Umbraco.Infrastructure.Media;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Actions;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.ContentApps;
|
||||
using Umbraco.Web.Editors;
|
||||
using Umbraco.Web.Features;
|
||||
using Umbraco.Web.HealthCheck;
|
||||
using Umbraco.Web.HealthCheck.NotificationMethods;
|
||||
using Umbraco.Web.Install;
|
||||
using Umbraco.Web.Macros;
|
||||
using Umbraco.Web.Media.EmbedProviders;
|
||||
using Umbraco.Web.Migrations.PostMigrations;
|
||||
using Umbraco.Web.Models.PublishedContent;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Search;
|
||||
using Umbraco.Web.Sections;
|
||||
using Umbraco.Web.Services;
|
||||
using Umbraco.Web.Templates;
|
||||
using Umbraco.Web.Trees;
|
||||
using IntegerValidator = Umbraco.Core.PropertyEditors.Validators.IntegerValidator;
|
||||
|
||||
@@ -42,7 +61,7 @@ namespace Umbraco.Core.Runtime
|
||||
public override void Compose(Composition composition)
|
||||
{
|
||||
base.Compose(composition);
|
||||
|
||||
|
||||
// composers
|
||||
composition
|
||||
.ComposeRepositories()
|
||||
@@ -177,6 +196,170 @@ namespace Umbraco.Core.Runtime
|
||||
|
||||
// Config manipulator
|
||||
composition.RegisterUnique<IConfigManipulator, JsonConfigManipulator>();
|
||||
|
||||
|
||||
// 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.
|
||||
composition.RegisterUnique<IUmbracoContextAccessor, HybridUmbracoContextAccessor>();
|
||||
|
||||
// register the umbraco context factory
|
||||
// composition.RegisterUnique<IUmbracoContextFactory, UmbracoContextFactory>();
|
||||
composition.RegisterUnique<IPublishedUrlProvider, UrlProvider>();
|
||||
|
||||
composition.RegisterUnique<HtmlLocalLinkParser>();
|
||||
composition.RegisterUnique<HtmlImageSourceParser>();
|
||||
composition.RegisterUnique<HtmlUrlParser>();
|
||||
composition.RegisterUnique<RichTextEditorPastedImages>();
|
||||
|
||||
// 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
|
||||
composition.PropertyValueConverters()
|
||||
.Remove<TinyMceValueConverter>()
|
||||
.Remove<TextStringValueConverter>()
|
||||
.Remove<MarkdownEditorValueConverter>();
|
||||
|
||||
composition.UrlProviders()
|
||||
.Append<AliasUrlProvider>()
|
||||
.Append<DefaultUrlProvider>();
|
||||
|
||||
composition.MediaUrlProviders()
|
||||
.Append<DefaultMediaUrlProvider>();
|
||||
|
||||
composition.RegisterUnique<ISiteDomainHelper, SiteDomainHelper>();
|
||||
|
||||
// register properties fallback
|
||||
composition.RegisterUnique<IPublishedValueFallback, PublishedValueFallback>();
|
||||
|
||||
composition.RegisterUnique<IImageUrlGenerator, ImageSharpImageUrlGenerator>();
|
||||
|
||||
composition.RegisterUnique<UmbracoFeatures>();
|
||||
|
||||
composition.Actions()
|
||||
.Add(() => composition.TypeLoader.GetTypes<IAction>());
|
||||
|
||||
composition.EditorValidators()
|
||||
.Add(() => composition.TypeLoader.GetTypes<IEditorValidator>());
|
||||
|
||||
|
||||
composition.TourFilters();
|
||||
|
||||
// replace with web implementation
|
||||
composition.RegisterUnique<IPublishedSnapshotRebuilder, PublishedSnapshotRebuilder>();
|
||||
|
||||
// register OEmbed providers - no type scanning - all explicit opt-in of adding types
|
||||
// note: IEmbedProvider is not IDiscoverable - think about it if going for type scanning
|
||||
composition.OEmbedProviders()
|
||||
.Append<YouTube>()
|
||||
.Append<Instagram>()
|
||||
.Append<Twitter>()
|
||||
.Append<Vimeo>()
|
||||
.Append<DailyMotion>()
|
||||
.Append<Flickr>()
|
||||
.Append<Slideshare>()
|
||||
.Append<Kickstarter>()
|
||||
.Append<GettyImages>()
|
||||
.Append<Ted>()
|
||||
.Append<Soundcloud>()
|
||||
.Append<Issuu>()
|
||||
.Append<Hulu>()
|
||||
.Append<Giphy>();
|
||||
|
||||
// register back office sections in the order we want them rendered
|
||||
composition.Sections()
|
||||
.Append<ContentSection>()
|
||||
.Append<MediaSection>()
|
||||
.Append<SettingsSection>()
|
||||
.Append<PackagesSection>()
|
||||
.Append<UsersSection>()
|
||||
.Append<MembersSection>()
|
||||
.Append<FormsSection>()
|
||||
.Append<TranslationSection>();
|
||||
|
||||
// register known content apps
|
||||
composition.ContentApps()
|
||||
.Append<ListViewContentAppFactory>()
|
||||
.Append<ContentEditorContentAppFactory>()
|
||||
.Append<ContentInfoContentAppFactory>();
|
||||
|
||||
// register published router
|
||||
composition.RegisterUnique<IPublishedRouter, PublishedRouter>();
|
||||
|
||||
// register *all* checks, except those marked [HideFromTypeFinder] of course
|
||||
composition.HealthChecks()
|
||||
.Add(() => composition.TypeLoader.GetTypes<HealthCheck>());
|
||||
|
||||
|
||||
composition.WithCollectionBuilder<HealthCheckNotificationMethodCollectionBuilder>()
|
||||
.Add(() => composition.TypeLoader.GetTypes<IHealthCheckNotificationMethod>());
|
||||
|
||||
composition.RegisterUnique<IContentLastChanceFinder, ContentFinderByConfigured404>();
|
||||
|
||||
composition.ContentFinders()
|
||||
// all built-in finders in the correct order,
|
||||
// devs can then modify this list on application startup
|
||||
.Append<ContentFinderByPageIdQuery>()
|
||||
.Append<ContentFinderByUrl>()
|
||||
.Append<ContentFinderByIdPath>()
|
||||
//.Append<ContentFinderByUrlAndTemplate>() // disabled, this is an odd finder
|
||||
.Append<ContentFinderByUrlAlias>()
|
||||
.Append<ContentFinderByRedirectUrl>();
|
||||
|
||||
composition.Register<UmbracoTreeSearcher>(Lifetime.Request);
|
||||
|
||||
composition.SearchableTrees()
|
||||
.Add(() => composition.TypeLoader.GetTypes<ISearchableTree>());
|
||||
|
||||
// replace some services
|
||||
composition.RegisterUnique<IEventMessagesFactory, DefaultEventMessagesFactory>();
|
||||
composition.RegisterUnique<IEventMessagesAccessor, HybridEventMessagesAccessor>();
|
||||
composition.RegisterUnique<ITreeService, TreeService>();
|
||||
composition.RegisterUnique<ISectionService, SectionService>();
|
||||
|
||||
composition.RegisterUnique<IExamineManager, ExamineManager>();
|
||||
|
||||
// register distributed cache
|
||||
composition.RegisterUnique(f => new DistributedCache(f.GetInstance<IServerMessenger>(), f.GetInstance<CacheRefresherCollection>()));
|
||||
|
||||
|
||||
composition.Register<ITagQuery, TagQuery>(Lifetime.Request);
|
||||
|
||||
composition.RegisterUnique<HtmlLocalLinkParser>();
|
||||
composition.RegisterUnique<HtmlUrlParser>();
|
||||
composition.RegisterUnique<HtmlImageSourceParser>();
|
||||
composition.RegisterUnique<RichTextEditorPastedImages>();
|
||||
|
||||
// we should stop injecting UmbracoContext and always inject IUmbracoContextAccessor, however at the moment
|
||||
// there are tons of places (controllers...) which require UmbracoContext in their ctor - so let's register
|
||||
// a way to inject the UmbracoContext - DO NOT register this as Lifetime.Request since LI will dispose the context
|
||||
// in it's own way but we don't want that to happen, we manage its lifetime ourselves.
|
||||
composition.Register(factory => factory.GetInstance<IUmbracoContextAccessor>().UmbracoContext);
|
||||
composition.RegisterUnique<IUmbracoTreeSearcherFields, UmbracoTreeSearcherFields>();
|
||||
composition.Register<IPublishedContentQuery>(factory =>
|
||||
{
|
||||
var umbCtx = factory.GetInstance<IUmbracoContextAccessor>();
|
||||
return new PublishedContentQuery(umbCtx.UmbracoContext.PublishedSnapshot, factory.GetInstance<IVariationContextAccessor>(), factory.GetInstance<IExamineManager>());
|
||||
}, Lifetime.Request);
|
||||
|
||||
|
||||
composition.RegisterUnique<IPublishedUrlProvider, UrlProvider>();
|
||||
|
||||
// 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.
|
||||
composition.RegisterUnique<IUmbracoContextAccessor, HybridUmbracoContextAccessor>();
|
||||
|
||||
// register accessors for cultures
|
||||
composition.RegisterUnique<IDefaultCultureAccessor, DefaultCultureAccessor>();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,37 +43,12 @@ namespace Umbraco.Web.Common.Runtime
|
||||
composition.RegisterUnique<IUmbracoRequestLifetimeManager>(factory => factory.GetInstance<UmbracoRequestLifetime>());
|
||||
composition.RegisterUnique<IUmbracoRequestLifetime>(factory => factory.GetInstance<UmbracoRequestLifetime>());
|
||||
|
||||
|
||||
//Password hasher
|
||||
composition.RegisterUnique<IPasswordHasher, AspNetCorePasswordHasher>();
|
||||
|
||||
|
||||
// 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.
|
||||
composition.RegisterUnique<IUmbracoContextAccessor, HybridUmbracoContextAccessor>();
|
||||
|
||||
// register the umbraco context factory
|
||||
// composition.RegisterUnique<IUmbracoContextFactory, UmbracoContextFactory>();
|
||||
composition.RegisterUnique<IPublishedUrlProvider, UrlProvider>();
|
||||
|
||||
composition.RegisterUnique<HtmlLocalLinkParser>();
|
||||
composition.RegisterUnique<HtmlImageSourceParser>();
|
||||
composition.RegisterUnique<HtmlUrlParser>();
|
||||
composition.RegisterUnique<RichTextEditorPastedImages>();
|
||||
|
||||
composition.UrlProviders()
|
||||
.Append<AliasUrlProvider>()
|
||||
.Append<DefaultUrlProvider>();
|
||||
|
||||
composition.MediaUrlProviders()
|
||||
.Append<DefaultMediaUrlProvider>();
|
||||
|
||||
composition.RegisterUnique<ISiteDomainHelper, SiteDomainHelper>();
|
||||
|
||||
// register properties fallback
|
||||
composition.RegisterUnique<IPublishedValueFallback, PublishedValueFallback>();
|
||||
|
||||
composition.RegisterUnique<IImageUrlGenerator, ImageSharpImageUrlGenerator>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,12 +40,7 @@ namespace Umbraco.Web
|
||||
=> composition.WithCollectionBuilder<FilteredControllerFactoryCollectionBuilder>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the backoffice OEmbed Providers collection builder.
|
||||
/// </summary>
|
||||
/// <param name="composition">The composition.</param>
|
||||
public static EmbedProvidersCollectionBuilder OEmbedProviders(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<EmbedProvidersCollectionBuilder>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the back office tree collection builder
|
||||
@@ -55,14 +50,6 @@ namespace Umbraco.Web
|
||||
public static TreeCollectionBuilder Trees(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<TreeCollectionBuilder>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the back office searchable tree collection builder
|
||||
/// </summary>
|
||||
/// <param name="composition"></param>
|
||||
/// <returns></returns>
|
||||
public static SearchableTreeCollectionBuilder SearchableTrees(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<SearchableTreeCollectionBuilder>();
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -95,43 +95,14 @@ namespace Umbraco.Web.Runtime
|
||||
composition.RegisterUnique<IMemberUserKeyProvider, MemberUserKeyProvider>();
|
||||
composition.RegisterUnique<IPublicAccessChecker, PublicAccessChecker>();
|
||||
|
||||
// register accessors for cultures
|
||||
composition.RegisterUnique<IDefaultCultureAccessor, DefaultCultureAccessor>();
|
||||
|
||||
|
||||
// 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.
|
||||
composition.RegisterUnique<IUmbracoContextAccessor, HybridUmbracoContextAccessor>();
|
||||
|
||||
// register the umbraco context factory
|
||||
composition.RegisterUnique<IUmbracoContextFactory, UmbracoContextFactory>();
|
||||
composition.RegisterUnique<IPublishedUrlProvider, UrlProvider>();
|
||||
|
||||
// we should stop injecting UmbracoContext and always inject IUmbracoContextAccessor, however at the moment
|
||||
// there are tons of places (controllers...) which require UmbracoContext in their ctor - so let's register
|
||||
// a way to inject the UmbracoContext - DO NOT register this as Lifetime.Request since LI will dispose the context
|
||||
// in it's own way but we don't want that to happen, we manage its lifetime ourselves.
|
||||
composition.Register(factory => factory.GetInstance<IUmbracoContextAccessor>().UmbracoContext);
|
||||
composition.RegisterUnique<IUmbracoTreeSearcherFields, UmbracoTreeSearcherFields>();
|
||||
composition.Register<IPublishedContentQuery>(factory =>
|
||||
{
|
||||
var umbCtx = factory.GetInstance<IUmbracoContextAccessor>();
|
||||
return new PublishedContentQuery(umbCtx.UmbracoContext.PublishedSnapshot, factory.GetInstance<IVariationContextAccessor>(), factory.GetInstance<IExamineManager>());
|
||||
}, Lifetime.Request);
|
||||
composition.Register<ITagQuery, TagQuery>(Lifetime.Request);
|
||||
|
||||
composition.RegisterUnique<ITemplateRenderer, TemplateRenderer>();
|
||||
composition.RegisterUnique<IMacroRenderer, MacroRenderer>();
|
||||
|
||||
composition.RegisterUnique<IUmbracoComponentRenderer, UmbracoComponentRenderer>();
|
||||
|
||||
composition.RegisterUnique<HtmlLocalLinkParser>();
|
||||
composition.RegisterUnique<HtmlUrlParser>();
|
||||
composition.RegisterUnique<HtmlImageSourceParser>();
|
||||
composition.RegisterUnique<RichTextEditorPastedImages>();
|
||||
|
||||
// register the umbraco helper - this is Transient! very important!
|
||||
// also, if not level.Run, we cannot really use the helper (during upgrade...)
|
||||
// so inject a "void" helper (not exactly pretty but...)
|
||||
@@ -145,19 +116,8 @@ namespace Umbraco.Web.Runtime
|
||||
else
|
||||
composition.Register(_ => new UmbracoHelper());
|
||||
|
||||
// register distributed cache
|
||||
composition.RegisterUnique(f => new DistributedCache(f.GetInstance<IServerMessenger>(), f.GetInstance<CacheRefresherCollection>()));
|
||||
|
||||
composition.RegisterUnique<RoutableDocumentFilter>();
|
||||
|
||||
// replace some services
|
||||
composition.RegisterUnique<IEventMessagesFactory, DefaultEventMessagesFactory>();
|
||||
composition.RegisterUnique<IEventMessagesAccessor, HybridEventMessagesAccessor>();
|
||||
composition.RegisterUnique<ITreeService, TreeService>();
|
||||
composition.RegisterUnique<ISectionService, SectionService>();
|
||||
|
||||
composition.RegisterUnique<IExamineManager, ExamineManager>();
|
||||
|
||||
// configure the container for web
|
||||
composition.ConfigureForWeb();
|
||||
|
||||
@@ -165,21 +125,6 @@ namespace Umbraco.Web.Runtime
|
||||
.ComposeUmbracoControllers(GetType().Assembly)
|
||||
.SetDefaultRenderMvcController<RenderMvcController>(); // default controller for template views
|
||||
|
||||
composition.SearchableTrees()
|
||||
.Add(() => composition.TypeLoader.GetTypes<ISearchableTree>());
|
||||
|
||||
composition.Register<UmbracoTreeSearcher>(Lifetime.Request);
|
||||
|
||||
composition.EditorValidators()
|
||||
.Add(() => composition.TypeLoader.GetTypes<IEditorValidator>());
|
||||
|
||||
composition.TourFilters();
|
||||
|
||||
composition.RegisterUnique<UmbracoFeatures>();
|
||||
|
||||
composition.Actions()
|
||||
.Add(() => composition.TypeLoader.GetTypes<IAction>());
|
||||
|
||||
//we need to eagerly scan controller types since they will need to be routed
|
||||
composition.WithCollectionBuilder<SurfaceControllerTypeCollectionBuilder>()
|
||||
.Add(composition.TypeLoader.GetSurfaceControllers());
|
||||
@@ -187,113 +132,32 @@ namespace Umbraco.Web.Runtime
|
||||
composition.WithCollectionBuilder<UmbracoApiControllerTypeCollectionBuilder>()
|
||||
.Add(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
|
||||
composition.PropertyValueConverters()
|
||||
.Remove<TinyMceValueConverter>()
|
||||
.Remove<TextStringValueConverter>()
|
||||
.Remove<MarkdownEditorValueConverter>();
|
||||
|
||||
// add all known factories, devs can then modify this list on application
|
||||
// startup either by binding to events or in their own global.asax
|
||||
composition.FilteredControllerFactory()
|
||||
.Append<RenderControllerFactory>();
|
||||
|
||||
composition.UrlProviders()
|
||||
.Append<AliasUrlProvider>()
|
||||
.Append<DefaultUrlProvider>();
|
||||
|
||||
composition.MediaUrlProviders()
|
||||
.Append<DefaultMediaUrlProvider>();
|
||||
|
||||
composition.RegisterUnique<IImageUrlGenerator, ImageSharpImageUrlGenerator>();
|
||||
|
||||
composition.RegisterUnique<IContentLastChanceFinder, ContentFinderByConfigured404>();
|
||||
|
||||
composition.ContentFinders()
|
||||
// all built-in finders in the correct order,
|
||||
// devs can then modify this list on application startup
|
||||
.Append<ContentFinderByPageIdQuery>()
|
||||
.Append<ContentFinderByUrl>()
|
||||
.Append<ContentFinderByIdPath>()
|
||||
//.Append<ContentFinderByUrlAndTemplate>() // disabled, this is an odd finder
|
||||
.Append<ContentFinderByUrlAlias>()
|
||||
.Append<ContentFinderByRedirectUrl>();
|
||||
|
||||
composition.RegisterUnique<ISiteDomainHelper, SiteDomainHelper>();
|
||||
|
||||
// register *all* checks, except those marked [HideFromTypeFinder] of course
|
||||
composition.HealthChecks()
|
||||
.Add(() => composition.TypeLoader.GetTypes<HealthCheck.HealthCheck>());
|
||||
|
||||
composition.WithCollectionBuilder<HealthCheckNotificationMethodCollectionBuilder>()
|
||||
.Add(() => composition.TypeLoader.GetTypes<HealthCheck.NotificationMethods.IHealthCheckNotificationMethod>());
|
||||
|
||||
// auto-register views
|
||||
composition.RegisterAuto(typeof(UmbracoViewPage<>));
|
||||
|
||||
// register published router
|
||||
composition.RegisterUnique<IPublishedRouter, PublishedRouter>();
|
||||
|
||||
// register preview SignalR hub
|
||||
composition.RegisterUnique(_ => GlobalHost.ConnectionManager.GetHubContext<PreviewHub>());
|
||||
|
||||
// register properties fallback
|
||||
composition.RegisterUnique<IPublishedValueFallback, PublishedValueFallback>();
|
||||
|
||||
// register known content apps
|
||||
composition.ContentApps()
|
||||
.Append<ListViewContentAppFactory>()
|
||||
.Append<ContentEditorContentAppFactory>()
|
||||
.Append<ContentInfoContentAppFactory>();
|
||||
|
||||
// register back office sections in the order we want them rendered
|
||||
composition.Sections()
|
||||
.Append<ContentSection>()
|
||||
.Append<MediaSection>()
|
||||
.Append<SettingsSection>()
|
||||
.Append<PackagesSection>()
|
||||
.Append<UsersSection>()
|
||||
.Append<MembersSection>()
|
||||
.Append<FormsSection>()
|
||||
.Append<TranslationSection>();
|
||||
|
||||
// register back office trees
|
||||
// the collection builder only accepts types inheriting from TreeControllerBase
|
||||
// and will filter out those that are not attributed with TreeAttribute
|
||||
composition.Trees()
|
||||
.AddTreeControllers(umbracoApiControllerTypes.Where(x => typeof(TreeControllerBase).IsAssignableFrom(x)));
|
||||
|
||||
// register OEmbed providers - no type scanning - all explicit opt-in of adding types
|
||||
// note: IEmbedProvider is not IDiscoverable - think about it if going for type scanning
|
||||
composition.OEmbedProviders()
|
||||
.Append<YouTube>()
|
||||
.Append<Instagram>()
|
||||
.Append<Twitter>()
|
||||
.Append<Vimeo>()
|
||||
.Append<DailyMotion>()
|
||||
.Append<Flickr>()
|
||||
.Append<Slideshare>()
|
||||
.Append<Kickstarter>()
|
||||
.Append<GettyImages>()
|
||||
.Append<Ted>()
|
||||
.Append<Soundcloud>()
|
||||
.Append<Issuu>()
|
||||
.Append<Hulu>()
|
||||
.Append<Giphy>();
|
||||
|
||||
|
||||
// replace with web implementation
|
||||
composition.RegisterUnique<IPublishedSnapshotRebuilder, Migrations.PostMigrations.PublishedSnapshotRebuilder>();
|
||||
|
||||
// Config manipulator
|
||||
composition.RegisterUnique<IConfigManipulator, XmlConfigManipulator>();
|
||||
|
||||
//ApplicationShutdownRegistry
|
||||
composition.RegisterUnique<IApplicationShutdownRegistry, AspNetApplicationShutdownRegistry>();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,6 @@
|
||||
<Compile Include="Mvc\ValidateMvcAngularAntiForgeryTokenAttribute.cs" />
|
||||
<Compile Include="OwinMiddlewareConfiguredEventArgs.cs" />
|
||||
<Compile Include="Editors\RedirectUrlManagementController.cs" />
|
||||
<Compile Include="DefaultEventMessagesFactory.cs" />
|
||||
<Compile Include="Security\ExternalSignInAutoLinkOptions.cs" />
|
||||
<Compile Include="Security\FixWindowsAuthMiddlware.cs" />
|
||||
<Compile Include="Security\ForceRenewalCookieAuthenticationHandler.cs" />
|
||||
|
||||
Reference in New Issue
Block a user