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:
Shannon
2015-01-21 12:48:08 +11:00
parent 215113d635
commit 13a4d5c81c
65 changed files with 9433 additions and 1174 deletions

View File

@@ -1,12 +1,24 @@
using Umbraco.Core.ObjectResolution;
using System;
using Umbraco.Core.LightInject;
using Umbraco.Core.ObjectResolution;
namespace Umbraco.Core.Models.PublishedContent
{
/// <summary>
/// Resolves the IPublishedContentModelFactory object.
/// </summary>
public class PublishedContentModelFactoryResolver : SingleObjectResolverBase<PublishedContentModelFactoryResolver, IPublishedContentModelFactory>
public class PublishedContentModelFactoryResolver : ContainerSingleObjectResolver<PublishedContentModelFactoryResolver, IPublishedContentModelFactory>
{
/// <summary>
/// Initializes the resolver to use IoC
/// </summary>
/// <param name="container"></param>
/// <param name="implementationType"></param>
internal PublishedContentModelFactoryResolver(IServiceContainer container, Type implementationType)
: base(container, implementationType)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PublishedContentModelFactoryResolver"/>.
/// </summary>
@@ -24,6 +36,15 @@ namespace Umbraco.Core.Models.PublishedContent
: base(factory)
{ }
/// <summary>
/// Initialize the resolver to use IoC, when using this contructor the type must be set manually
/// </summary>
/// <param name="container"></param>
internal PublishedContentModelFactoryResolver(IServiceContainer container)
: base(container)
{
}
/// <summary>
/// Sets the factory.
/// </summary>