Search code examples
asp.netwebformsdirectory-structure

Where do you place your (view specific) classes in an ASP.NET Web Forms


Our Site is getting bigger now and we have to apply some structuring to the web application.

Currently it looks like this:

- App_Themes
- Content (NuGet, untouched)
  - themes
    - base
- Libs
- Pages
  - A
    - PageOfA1.aspx
    - PageOfA2.aspx
  - B
    - PageOfB1.aspx
    - PageOfB2.aspx
  - LogOn.aspx
  - Site.master
- Resources
  - Images
  - Reports
  - Scripts
  - Styles
- Scripts (NuGet, untouched)
- UserControls

I´d like to see some of your directory structures and especially I want to know: Where should we place our view specific class files (*.cs) that are beeing used within the code behind of the *.aspx pages? Since now we were relatively happy with placing them inside the corresponding *.aspx.cs files because of the physical nearness.

But we're about to activate the StyleCop rule that enforces a single class per file. So where should I place these files?

I´m consciously not telling you my ideas because I´m unhappy with all of them and if they would match one of mine I will live with that unhappy feeling concerning that solution anyway.


Solution

  • I would recommend a seperation of concern. Have a project for your data access, one for your domain models, one for services and one for testing.

    Check this link for information on N-Tier architecture - http://www.codeproject.com/Articles/430014/N-Tier-Architecture-and-Tips