所以 .cshtml 默认看不到 app_code

so the .cshtml doesn't see app_code by defaul

我以为 app_code 文件夹在那里,这样剃刀就知道在哪里寻找 类 之类的东西,但看来我仍然需要添加 @using.

那么 app_code 文件夹的用途是什么?

ASP.NET 网站(与 Web 应用程序相对),包括网页,只能访问 App_Code 文件夹中的 类。

您的问题很可能是您向 类 添加了命名空间,因此您必须使用 @using

如果您在 App_Code 类 中省略了命名空间,那么您将不必使用 @using.