How to organize ASP.NET app_code folder? [closed]

妖精的绣舞 提交于 2019-12-05 00:16:41

问题


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?


回答1:


Use folders...

Or move all your classes out to a Class Library for your Web site and reference that library.

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

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.




回答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.




回答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.

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.

For other approach you just need to logically group .cs files into diffrent folder.



来源:https://stackoverflow.com/questions/922719/how-to-organize-asp-net-app-code-folder

标签

工具导航Map