mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +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;
|
||||
|
||||
namespace Orchard.Mvc.Html {
|
||||
public interface IFoo{}
|
||||
public static class ContainerExtensions {
|
||||
/// <summary>
|
||||
/// This method performed by Erik Weisz.
|
||||
@@ -12,7 +13,7 @@ namespace Orchard.Mvc.Html {
|
||||
var workContext = html.ViewContext.RequestContext.GetWorkContext();
|
||||
|
||||
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>();
|
||||
}
|
||||
|
Reference in New Issue
Block a user