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:
Nathan Heskew
2010-11-29 10:21:54 -08:00
parent 974054aa72
commit a1c8765fa0

View File

@@ -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>();
}