Fixes: #U4-1357 - more properties to expose context objects on SurfaceController and RenderMvcController base classes.

This commit is contained in:
Shannon Deminick
2012-12-28 18:31:10 +03:00
parent 116a87f5c5
commit 020fa577f0
2 changed files with 52 additions and 0 deletions

View File

@@ -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; }
}
/// <summary>
/// Returns a ServiceContext
/// </summary>
public ServiceContext Services
{
get { return ApplicationContext.Services; }
}
/// <summary>
/// Returns a DatabaseContext
/// </summary>
public DatabaseContext DatabaseContext
{
get { return ApplicationContext.DatabaseContext; }
}
/// <summary>
/// Returns the metadata for this instance
/// </summary>

View File

@@ -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;
/// <summary>
/// Returns an UmbracoHelper object
/// </summary>
public UmbracoHelper Umbraco
{
get { return _umbraco ?? (_umbraco = new UmbracoHelper(UmbracoContext)); }
}
/// <summary>
/// Returns the current UmbracoContext
/// </summary>
@@ -25,6 +36,30 @@ namespace Umbraco.Web.Mvc
get { return PublishedContentRequest.RoutingContext.UmbracoContext; }
}
/// <summary>
/// Returns the current ApplicationContext
/// </summary>
public ApplicationContext ApplicationContext
{
get { return UmbracoContext.Application; }
}
/// <summary>
/// Returns a ServiceContext
/// </summary>
public ServiceContext Services
{
get { return ApplicationContext.Services; }
}
/// <summary>
/// Returns a DatabaseContext
/// </summary>
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
/// <summary>
/// Returns the current PublishedContentRequest