diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentModelFactoryImpl.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentModelFactoryImpl.cs index af2bdd6859..7bc0343add 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentModelFactoryImpl.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentModelFactoryImpl.cs @@ -22,8 +22,6 @@ namespace Umbraco.Core.Models.PublishedContent foreach (var type in types) { - if (type.Inherits() == false) - throw new InvalidOperationException(string.Format("Type {0} is marked with PublishedContentModel attribute but does not inherit from PublishedContentExtended.", type.FullName)); var constructor = type.GetConstructor(ctorArgTypes); if (constructor == null) throw new InvalidOperationException(string.Format("Type {0} is missing a public constructor with one argument of type IPublishedContent.", type.FullName)); diff --git a/src/Umbraco.Web/Standalone/StandaloneApplication.cs b/src/Umbraco.Web/Standalone/StandaloneApplication.cs index cdaf8718c1..64e2975dc2 100644 --- a/src/Umbraco.Web/Standalone/StandaloneApplication.cs +++ b/src/Umbraco.Web/Standalone/StandaloneApplication.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Umbraco.Core; +using Umbraco.Core.ObjectResolution; namespace Umbraco.Web.Standalone { @@ -49,17 +50,40 @@ namespace Umbraco.Web.Standalone /// /// Starts the application. /// - public void Start() + public void Start(bool noerr = false) { lock (AppLock) { if (_started) + { + if (noerr) return; throw new InvalidOperationException("Application has already started."); + } Application_Start(this, EventArgs.Empty); _started = true; } } + public void Terminate(bool noerr = false) + { + lock (AppLock) + { + if (_started == false) + { + if (noerr) return; + throw new InvalidOperationException("Application has already been terminated."); + } + + ApplicationContext.Current.DisposeIfDisposable(); // should reset resolution, clear caches & resolvers... + ApplicationContext.Current = null; + UmbracoContext.Current.DisposeIfDisposable(); // dunno + UmbracoContext.Current = null; + + _started = false; + _application = null; + } + } + #endregion #region IApplicationEventHandler management diff --git a/src/Umbraco.Web/Standalone/StandaloneBootManager.cs b/src/Umbraco.Web/Standalone/StandaloneBootManager.cs index 7b2fcb5ad2..d119e4e31c 100644 --- a/src/Umbraco.Web/Standalone/StandaloneBootManager.cs +++ b/src/Umbraco.Web/Standalone/StandaloneBootManager.cs @@ -81,10 +81,7 @@ namespace Umbraco.Web.Standalone base.FreezeResolution(); var httpContext = new StandaloneHttpContext(); - UmbracoContext.EnsureContext( - httpContext, - ApplicationContext.Current, - new WebSecurity(httpContext, ApplicationContext.Current)); + UmbracoContext.EnsureContext(httpContext, ApplicationContext.Current, false, false); } } } diff --git a/src/Umbraco.Web/Standalone/StandaloneHttpContext.cs b/src/Umbraco.Web/Standalone/StandaloneHttpContext.cs index ac34e405e5..dec95dd372 100644 --- a/src/Umbraco.Web/Standalone/StandaloneHttpContext.cs +++ b/src/Umbraco.Web/Standalone/StandaloneHttpContext.cs @@ -65,6 +65,9 @@ namespace Umbraco.Web.Standalone internal class StandaloneHttpRequest : HttpRequestBase { - + public override Uri Url + { + get { return new Uri("http://localhost"); } + } } }