asp.net-mvc-3 – 我可以在App_Code之外使用全局剃须刀@helper吗?

问题很简单,如标题所示:有没有办法在“App_Code”之外使用剃刀助手?

示例(HtmlEx.cshtml文件):

@helper Script(string fileName,UrlHelper url)
{
<script src="@url.Content("~/Scripts/" + fileName)" type="text/javascript"></script> 
}

我问这个是因为我没有什么别的可以放入App_Code;我想结构我的项目有点不一样。

谢谢。

更新:我不想要任何其他类型的扩展。斯科特在这里谈论的只有纯粹的剃刀助手,我才有兴趣:http://weblogs.asp.net/scottgu/archive/2011/05/12/asp-net-mvc-3-and-the-helper-syntax-within-razor.aspx

解决方法

The question is simple as stated in the title: Is there a way of
having razor helpers outside of ‘App_Code’?

不,没有。

相关文章

这篇文章主要讲解了“WPF如何实现带筛选功能的DataGrid”,文...
本篇内容介绍了“基于WPF如何实现3D画廊动画效果”的有关知识...
Some samples are below for ASP.Net web form controls:(fr...
问题描述: 对于未定义为 System.String 的列,唯一有效的值...
最近用到了CalendarExtender,结果不知道为什么发生了错位,...
ASP.NET 2.0 page lifecyle ASP.NET 2.0 event sequence cha...