views:

1339

answers:

5

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  A: 

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.

JerSchneid
+9  A: 

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
Eoin Campbell
+5  A: 

I would suggest putting you .cs files in different projects if possible, and the just importing the .dll file.

Egil Hansen
A: 

If it's getting to big, you may consider to move your logic out in a separate class library or even multiple libraries.

typically you would separate between your databse logic, business logic and some other infrastrucural stuff that you might have, which at last might end up in something like this Kona, mvc sample app

checkout some of the opensource projects.

Cshift3iLike
A: 

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.

jalpesh