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,13 +1,27 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Umbraco.Core.LightInject;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache
|
||||
{
|
||||
//TODO: REmove this requirement, just use normal IoC and publicize IPublishedCaches
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the IPublishedCaches object.
|
||||
/// </summary>
|
||||
internal sealed class PublishedCachesResolver : SingleObjectResolverBase<PublishedCachesResolver, IPublishedCaches>
|
||||
internal sealed class PublishedCachesResolver : ContainerSingleObjectResolver<PublishedCachesResolver, IPublishedCaches>
|
||||
{
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Initializes the resolver to use IoC
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <param name="implementationType"></param>
|
||||
public PublishedCachesResolver(IServiceContainer container, Type implementationType) : base(container, implementationType)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PublishedCachesResolver"/> class with caches.
|
||||
/// </summary>
|
||||
/// <param name="caches">The caches.</param>
|
||||
@@ -16,7 +30,16 @@ namespace Umbraco.Web.PublishedCache
|
||||
: base(caches)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Initializes the resolver to use IoC
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <param name="implementationType"></param>
|
||||
public PublishedCachesResolver(IServiceContainer container, Expression<Func<IServiceFactory, IPublishedCaches>> implementationType) : base(container, implementationType)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the caches.
|
||||
/// </summary>
|
||||
/// <param name="caches">The caches.</param>
|
||||
|
||||
Reference in New Issue
Block a user