In ASP.NET my app_code folder has a ton of .cs files in it. It would be great if I could organize them by the module they belong to in my project so I am not scrolling forever when I expand the app_code folder. How do you organize yours?
在ASP.NET中,我的app_code文件夹中有大量的.cs文件。如果我可以通过他们属于我的项目中的模块来组织它们会很棒,所以当我展开app_code文件夹时我不会永远滚动它。你是如何组织自己的?
4 个解决方案
#1
Use folders...
Or move all your classes out to a Class Library for your Web site and reference that library.
或者将所有类移到Web站点的类库中并引用该库。
Then properly folder & namespace all your classes there.
然后在那里正确地命名和命名所有类。
In the past, where I've had to use the App_Code folder I've mirrored the folder structure of the main site for anything specific and had a common folder for everything else
在过去,我必须使用App_Code文件夹,我已经镜像了主站点的文件夹结构,用于任何特定的文件夹,并为其他所有文件夹提供了一个公共文件夹
e.g.
Site
|- App_Code
|- Login
|- Common
|- Controls
|- AdminArea
|- SomethingElse
|- Login
|- Controls
|- AdminArea
|- SomethingElse
\- Default.aspx
#2
I would suggest putting you .cs files in different projects if possible, and the just importing the .dll file.
我建议如果可能的话,将.cs文件放在不同的项目中,然后只导入.dll文件。
#3
We try keep things in relevant folders within App_Code. For example, we have a feature/product called DataLinx, so there is a DataLinx folder under App_Code with all the relevant files in here.
我们尝试将内容保存在App_Code中的相关文件夹中。例如,我们有一个名为DataLinx的功能/产品,因此App_Code下有一个DataLinx文件夹,其中包含所有相关文件。
#4
There may be two options create projects for the diffrent layers and functionality. Or create a folder in app_code folder for diffent functionaltiy.
可能有两个选项为不同的层和功能创建项目。或者在app_code文件夹中创建一个文件夹,以获得不同的功能。
Suppose you are using first one then you need to create each class library project for every layer. Like database layer,business logic layer, Common Controls etc. Create a solution and add this all project. Reference the project dll for your need.
假设您正在使用第一个,那么您需要为每个层创建每个类库项目。像数据库层,业务逻辑层,公共控件等。创建一个解决方案并添加所有项目。参考项目dll以满足您的需求。
For other approach you just need to logically group .cs files into diffrent folder.
对于其他方法,您只需要将.cs文件逻辑分组到不同的文件夹中。
#1
Use folders...
Or move all your classes out to a Class Library for your Web site and reference that library.
或者将所有类移到Web站点的类库中并引用该库。
Then properly folder & namespace all your classes there.
然后在那里正确地命名和命名所有类。
In the past, where I've had to use the App_Code folder I've mirrored the folder structure of the main site for anything specific and had a common folder for everything else
在过去,我必须使用App_Code文件夹,我已经镜像了主站点的文件夹结构,用于任何特定的文件夹,并为其他所有文件夹提供了一个公共文件夹
e.g.
Site
|- App_Code
|- Login
|- Common
|- Controls
|- AdminArea
|- SomethingElse
|- Login
|- Controls
|- AdminArea
|- SomethingElse
\- Default.aspx
#2
I would suggest putting you .cs files in different projects if possible, and the just importing the .dll file.
我建议如果可能的话,将.cs文件放在不同的项目中,然后只导入.dll文件。
#3
We try keep things in relevant folders within App_Code. For example, we have a feature/product called DataLinx, so there is a DataLinx folder under App_Code with all the relevant files in here.
我们尝试将内容保存在App_Code中的相关文件夹中。例如,我们有一个名为DataLinx的功能/产品,因此App_Code下有一个DataLinx文件夹,其中包含所有相关文件。
#4
There may be two options create projects for the diffrent layers and functionality. Or create a folder in app_code folder for diffent functionaltiy.
可能有两个选项为不同的层和功能创建项目。或者在app_code文件夹中创建一个文件夹,以获得不同的功能。
Suppose you are using first one then you need to create each class library project for every layer. Like database layer,business logic layer, Common Controls etc. Create a solution and add this all project. Reference the project dll for your need.
假设您正在使用第一个,那么您需要为每个层创建每个类库项目。像数据库层,业务逻辑层,公共控件等。创建一个解决方案并添加所有项目。参考项目dll以满足您的需求。
For other approach you just need to logically group .cs files into diffrent folder.
对于其他方法,您只需要将.cs文件逻辑分组到不同的文件夹中。