diff --git a/src/Umbraco.Web/Mvc/PluginController.cs b/src/Umbraco.Web/Mvc/PluginController.cs index dd08ba08a7..bbba1fb2d2 100644 --- a/src/Umbraco.Web/Mvc/PluginController.cs +++ b/src/Umbraco.Web/Mvc/PluginController.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Concurrent; using System.Web.Mvc; using Umbraco.Core; +using Umbraco.Core.Services; namespace Umbraco.Web.Mvc { @@ -51,6 +52,22 @@ namespace Umbraco.Web.Mvc get { return UmbracoContext.Application; } } + /// + /// Returns a ServiceContext + /// + public ServiceContext Services + { + get { return ApplicationContext.Services; } + } + + /// + /// Returns a DatabaseContext + /// + public DatabaseContext DatabaseContext + { + get { return ApplicationContext.DatabaseContext; } + } + /// /// Returns the metadata for this instance /// diff --git a/src/Umbraco.Web/Mvc/RenderMvcController.cs b/src/Umbraco.Web/Mvc/RenderMvcController.cs index 9a7d0a4f64..ac65d28d3d 100644 --- a/src/Umbraco.Web/Mvc/RenderMvcController.cs +++ b/src/Umbraco.Web/Mvc/RenderMvcController.cs @@ -1,7 +1,9 @@ using System; using System.IO; using System.Web.Mvc; +using Umbraco.Core; using Umbraco.Core.Logging; +using Umbraco.Core.Services; using Umbraco.Web.Models; using Umbraco.Web.Routing; @@ -17,6 +19,15 @@ namespace Umbraco.Web.Mvc private PublishedContentRequest _publishedContentRequest; + private UmbracoHelper _umbraco; + /// + /// Returns an UmbracoHelper object + /// + public UmbracoHelper Umbraco + { + get { return _umbraco ?? (_umbraco = new UmbracoHelper(UmbracoContext)); } + } + /// /// Returns the current UmbracoContext /// @@ -25,6 +36,30 @@ namespace Umbraco.Web.Mvc get { return PublishedContentRequest.RoutingContext.UmbracoContext; } } + /// + /// Returns the current ApplicationContext + /// + public ApplicationContext ApplicationContext + { + get { return UmbracoContext.Application; } + } + + /// + /// Returns a ServiceContext + /// + public ServiceContext Services + { + get { return ApplicationContext.Services; } + } + + /// + /// Returns a DatabaseContext + /// + public DatabaseContext DatabaseContext + { + get { return ApplicationContext.DatabaseContext; } + } + //TODO: make this protected once we make PublishedContentRequest not internal after we figure out what it should actually contain /// /// Returns the current PublishedContentRequest