WIP - have added LightInject as a fast and tiny IoC container that is embedded. Have updated all required SingleObjectResolverBase and non lazy ManyObjectResolverBase to use a Container implementation. Have updated the boot managers to use IoC to instantiate all their requirements. This is so much nicer now by using IoC to ctor all of the objects in these resolvers we can get ctor injection OOTB so no more singletons. Need to create resolver to support the lazy resolver with IoC next. Updated IContentFinders, IThumbnailProviders to use ctor injection.
This commit is contained in:
@@ -1,20 +1,33 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Umbraco.Core.LightInject;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Resolves the last chance IPublishedContentFinder object.
|
||||
/// </summary>
|
||||
public sealed class ContentLastChanceFinderResolver : SingleObjectResolverBase<ContentLastChanceFinderResolver, IContentFinder>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ContentLastChanceFinderResolver"/> class with no finder.
|
||||
/// </summary>
|
||||
/// <remarks>The resolver is created by the <c>WebBootManager</c> and thus the constructor remains internal.</remarks>
|
||||
internal ContentLastChanceFinderResolver()
|
||||
: base(true)
|
||||
{ }
|
||||
/// </summary>
|
||||
public sealed class ContentLastChanceFinderResolver : ContainerSingleObjectResolver<ContentLastChanceFinderResolver, IContentFinder>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the resolver to use IoC
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <param name="implementationType"></param>
|
||||
internal ContentLastChanceFinderResolver(IServiceContainer container, Type implementationType)
|
||||
: base(container, implementationType)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ContentLastChanceFinderResolver"/> class with no finder.
|
||||
/// </summary>
|
||||
/// <remarks>The resolver is created by the <c>WebBootManager</c> and thus the constructor remains internal.</remarks>
|
||||
internal ContentLastChanceFinderResolver()
|
||||
: base(true)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ContentLastChanceFinderResolver"/> class with an instance of a finder.
|
||||
@@ -24,24 +37,34 @@ namespace Umbraco.Web.Routing
|
||||
internal ContentLastChanceFinderResolver(IContentFinder finder)
|
||||
: base(finder, true)
|
||||
{ }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the last chance finder.
|
||||
/// </summary>
|
||||
/// <param name="finder">The finder.</param>
|
||||
/// <remarks>For developers, at application startup.</remarks>
|
||||
public void SetFinder(IContentFinder finder)
|
||||
{
|
||||
Value = finder;
|
||||
}
|
||||
/// Initializes the resolver to use IoC
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <param name="implementationType"></param>
|
||||
internal ContentLastChanceFinderResolver(IServiceContainer container, Expression<Func<IServiceFactory, IContentFinder>> implementationType)
|
||||
: base(container, implementationType)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last chance finder.
|
||||
/// </summary>
|
||||
public IContentFinder Finder
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the last chance finder.
|
||||
/// </summary>
|
||||
/// <param name="finder">The finder.</param>
|
||||
/// <remarks>For developers, at application startup.</remarks>
|
||||
public void SetFinder(IContentFinder finder)
|
||||
{
|
||||
Value = finder;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the last chance finder.
|
||||
/// </summary>
|
||||
public IContentFinder Finder
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user