Umbraco now installs and can install the starter kit... not much else though ;)
This commit is contained in:
@@ -471,48 +471,5 @@ namespace Umbraco.Core
|
||||
PublishedContentModelFactoryResolver.Current = new PublishedContentModelFactoryResolver(Container);
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// An IoC lifetime that will dispose instances at the end of the bootup sequence
|
||||
///// </summary>
|
||||
//private class BootManagerLifetime : ILifetime
|
||||
//{
|
||||
// public BootManagerLifetime(UmbracoApplicationBase appBase)
|
||||
// {
|
||||
// appBase.ApplicationStarted += appBase_ApplicationStarted;
|
||||
// }
|
||||
|
||||
// void appBase_ApplicationStarted(object sender, EventArgs e)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// private object _instance;
|
||||
|
||||
// /// <summary>
|
||||
// /// Returns a service instance according to the specific lifetime characteristics.
|
||||
// /// </summary>
|
||||
// /// <param name="createInstance">The function delegate used to create a new service instance.</param>
|
||||
// /// <param name="scope">The <see cref="Scope"/> of the current service request.</param>
|
||||
// /// <returns>The requested services instance.</returns>
|
||||
// public object GetInstance(Func<object> createInstance, Scope scope)
|
||||
// {
|
||||
// if (_instance == null)
|
||||
// {
|
||||
// _instance = createInstance();
|
||||
|
||||
// var disposable = _instance as IDisposable;
|
||||
// if (disposable != null)
|
||||
// {
|
||||
// if (scope == null)
|
||||
// {
|
||||
// throw new InvalidOperationException("Attempt to create an disposable object without a current scope.");
|
||||
// }
|
||||
// scope.TrackInstance(disposable);
|
||||
// }
|
||||
|
||||
// }
|
||||
// return createInstance;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,19 +138,19 @@ namespace Umbraco.Core.DependencyInjection
|
||||
factory.GetInstance<ILogger>(),
|
||||
factory.GetInstance<ISqlSyntaxProvider>(),
|
||||
factory.GetInstance<IMappingResolver>()));
|
||||
container.Register<IDatabaseUnitOfWork, IScriptRepository>((factory, work) => new ScriptRepository(
|
||||
container.Register<IUnitOfWork, IScriptRepository>((factory, work) => new ScriptRepository(
|
||||
work,
|
||||
factory.GetInstance<IFileSystem>("ScriptFileSystem"),
|
||||
factory.GetInstance<IContentSection>()));
|
||||
container.Register<IDatabaseUnitOfWork, IPartialViewRepository>((factory, work) => new PartialViewRepository(
|
||||
container.Register<IUnitOfWork, IPartialViewRepository>((factory, work) => new PartialViewRepository(
|
||||
work,
|
||||
factory.GetInstance<IFileSystem>("ScriptFileSystem")),
|
||||
serviceName: "PartialViewFileSystem");
|
||||
container.Register<IDatabaseUnitOfWork, IPartialViewRepository>((factory, work) => new PartialViewMacroRepository(
|
||||
container.Register<IUnitOfWork, IPartialViewRepository>((factory, work) => new PartialViewMacroRepository(
|
||||
work,
|
||||
factory.GetInstance<IFileSystem>("PartialViewMacroFileSystem")),
|
||||
serviceName: "PartialViewMacroRepository");
|
||||
container.Register<IDatabaseUnitOfWork, IStylesheetRepository>((factory, work) => new StylesheetRepository(
|
||||
container.Register<IUnitOfWork, IStylesheetRepository>((factory, work) => new StylesheetRepository(
|
||||
work,
|
||||
factory.GetInstance<IFileSystem>("StylesheetFileSystem")));
|
||||
container.Register<IDatabaseUnitOfWork, ITemplateRepository>((factory, work) => new TemplateRepository(
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Umbraco.Core.Persistence
|
||||
|
||||
public virtual ITemplateRepository CreateTemplateRepository(IDatabaseUnitOfWork uow)
|
||||
{
|
||||
return _container.GetInstance<IUnitOfWork, ITemplateRepository>(uow);
|
||||
return _container.GetInstance<IDatabaseUnitOfWork, ITemplateRepository>(uow);
|
||||
}
|
||||
|
||||
public virtual IMigrationEntryRepository CreateMigrationEntryRepository(IDatabaseUnitOfWork uow)
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Web
|
||||
{
|
||||
internal class DefaultUmbracoContextAccessor : IUmbracoContextAccessor
|
||||
{
|
||||
private readonly UmbracoContext _umbracoContext;
|
||||
private readonly Func<UmbracoContext> _umbracoContext;
|
||||
|
||||
public DefaultUmbracoContextAccessor(UmbracoContext umbracoContext)
|
||||
public DefaultUmbracoContextAccessor(Func<UmbracoContext> umbracoContext)
|
||||
{
|
||||
_umbracoContext = umbracoContext;
|
||||
}
|
||||
|
||||
public UmbracoContext Value
|
||||
{
|
||||
get { return _umbracoContext; }
|
||||
get { return _umbracoContext(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,6 +314,15 @@ namespace Umbraco.Web
|
||||
{
|
||||
base.ConfigureCoreServices(container);
|
||||
|
||||
container.EnablePerWebRequestScope();
|
||||
|
||||
container.Register<IUmbracoContextAccessor, DefaultUmbracoContextAccessor>(new PerContainerLifetime());
|
||||
//TODO: Is this lifespan correct? Need to ask Stephen because we have contextual ones too
|
||||
container.Register<IPublishedContentCache, PublishedContentCache>(new PerContainerLifetime());
|
||||
container.Register<IPublishedMediaCache, PublishedMediaCache>(new PerContainerLifetime());
|
||||
//no need to declare as per request, currently we manage it's lifetime as the singleton
|
||||
container.Register<UmbracoContext>(factory => UmbracoContext.Current);
|
||||
|
||||
//Replace services:
|
||||
container.Register<IEventMessagesFactory, RequestLifespanMessagesFactory>();
|
||||
}
|
||||
@@ -328,18 +337,9 @@ namespace Umbraco.Web
|
||||
|
||||
//IoC setup for LightInject for mvc/webapi
|
||||
Container.EnableMvc();
|
||||
Container.RegisterMvcControllers(PluginManager);
|
||||
container.EnablePerWebRequestScope();
|
||||
Container.RegisterMvcControllers(PluginManager);
|
||||
container.EnableWebApi(GlobalConfiguration.Configuration);
|
||||
container.RegisterApiControllers(PluginManager);
|
||||
|
||||
//register other services
|
||||
container.Register<IUmbracoContextAccessor, DefaultUmbracoContextAccessor>(new PerRequestLifeTime());
|
||||
//TODO: Is this lifespan correct? Need to ask Stephen because we have contextual ones too
|
||||
container.Register<IPublishedContentCache, PublishedContentCache>(new PerContainerLifetime());
|
||||
container.Register<IPublishedMediaCache, PublishedMediaCache>(new PerContainerLifetime());
|
||||
//no need to declare as per request, currently we manage it's lifetime as the singleton
|
||||
container.Register<UmbracoContext>(factory => UmbracoContext.Current);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user