Reputation: 11
I have an MVC app with two areas, one for each line of business (they share the root codebase). In the root HtmlHelper extensions class I have some generic HtmlHelpers applicable to both areas. Is it possible to have an Area specific HtmlHelper who's methods will show in intellisense only while coding in that specific area, be it via web.config of the area?
namespace System.Web.Mvc.Html{
public static class Helper{
public static MvcHtmlString CommonHelper(this HtmlHelper htmlHelper){
//some code here
}
}
}
namespace System.Web.Mvc.Html{
public static class Helper{
public static MvcHtmlString ExampleHelper(this HtmlHelper htmlHelper){
//area specific functions
}
}
}
Many thanks.
Upvotes: 1
Views: 326
Reputation: 1038770
You could define this HTML helper in the AppName.Areas.SomeAreaName.Extensions
namespace:
namespace AppName.Areas.SomeAreaName.Extensions
{
public static class Helper
{
...
}
}
and then use the namespaces section of the ~/Areas/SomeAreaName/Views/web.config
file to register it.
Upvotes: 1