mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Making the Resolve<TService> HtmlHelper extension method throw once again if a WorkContext isn't found in the request
--HG-- branch : dev
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
namespace Orchard.Mvc.Html {
|
namespace Orchard.Mvc.Html {
|
||||||
|
public interface IFoo{}
|
||||||
public static class ContainerExtensions {
|
public static class ContainerExtensions {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method performed by Erik Weisz.
|
/// This method performed by Erik Weisz.
|
||||||
@@ -12,7 +13,7 @@ namespace Orchard.Mvc.Html {
|
|||||||
var workContext = html.ViewContext.RequestContext.GetWorkContext();
|
var workContext = html.ViewContext.RequestContext.GetWorkContext();
|
||||||
|
|
||||||
if (workContext == null)
|
if (workContext == null)
|
||||||
return default(TService);
|
throw new ApplicationException(string.Format(@"The WorkContext cannot be found for the request. Unable to resolve '{0}'.", typeof(TService)));
|
||||||
|
|
||||||
return workContext.Resolve<TService>();
|
return workContext.Resolve<TService>();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user