问题
Like I said in the title of my question, is it possible to put the @helper template of cshtml file in a folder other than App_Code to be visible by my views?
I discovered the very nice article from ScottGu but I don't found any solution to my question.
Thank you.
回答1:
You can, if you write them as extension methods (static methods of a static class). Something like:
public static string AMethod(this HtmlHelper html, int arg)
...
Lets you call the method in a cshtml file as
@Html.AMethod(5)
来源:https://stackoverflow.com/questions/11689333/asp-net-mvc-helper-template-in-different-folder-than-app-code