本文介绍了ASP.NET MVC项目和APP_ code文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么APP_ code不是在VS解决方案资源管理器中添加ASP.NET文件夹的子菜单选择呢?我知道你可以自己手动只需重命名一个新的文件夹创建一个,但什么是合理的吗?这是不是你应该把效用或服务层类型类?

How come App_Code is not a choice in the Add ASP.NET Folder submenu in the VS solution explorer? I realize you can create one yourself manually by just renaming a New Folder, but what is the rational here? Is this not where you are supposed to put "utility" or "service layer" type classes?

在一个MVC项目方面说明。我不喜欢的事实,有一个参考System.Configuration出的开箱即用不同的是默认的ASP.NET Web窗体项目。

On a MVC project side note. I do like the fact that there is a reference to System.Configuration out-of-the-box unlike the default ASP.NET Web Form Projects.

推荐答案

真正的答案是因为微软要你,你需要VS做MVC买研究。然而,该项目以纯JIT是方式更容易...

The real answer is because Microsoft wants you to buy in that you need VS to do MVC. However, to convert the project to pure JIT which is way easier to work with...

您可以做pretty的直线前进。

You can do it pretty straight forward.

(1)将包含类文件中的所有文件夹 APP_ code (离开浏览文件夹,它是)
(2)使的Global.asax 不需要后面的code或继承参考通过删除这些属性,然后将

(1) Move all folders containing class files to App_Code (leave Views folder where it is)
(2) Make Global.asax not needing a code behind or inherits reference by removing those attributes then placing

[script runat="server"]
... place contents of code behind's class inner code
[/script]

和删除后面好了code

and delete the code behind for good

(3)在删除项目的DLL引用并确保保持其他必要的DLL运行MVC
条款(4)删除解决方案的文件和文件夹的属性和OBJ文件夹

(3) In Bin Remove the project DLL reference making sure to keep the other necessary DLLs in terms of running MVC
(4) Remove solution files and properties folder and obj folder

我这样做定期的NOP MVC作为其更易于与JIT Web层的工作。开发商不明白这是不是每天都工作在战壕上的许多网站所需要的各种自定义的快速修复。我们工作的网站获得数十万的点击率每天所以采用JIT已经没有性能损失初步递增之后。
似乎少即是多,当谈到小网站的发展。

I do this routinely for nop MVC as its much simpler to work with the web tier on JIT. Developers that don't understand this are not working in the trenches every day on many websites with various custom quick fixes needed. The sites we work on get hundreds thousands of hits per day so using JIT has no performance penalty after the initial bump.
Seems less is more when it comes to smaller website development.

这篇关于ASP.NET MVC项目和APP_ code文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 14:20