Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Project folder naming conventions

I have a project called Data which is a data layer. In this project, all files are just lying in the top folder. I have enumerations, POCOs, repositories, partial classes and so on.

If i want to move those files into subfolders, what would be the preffered folder name for each folder? Is there any convention?

The "Repositories" folder is pretty obvious, but where should i keep POCOs and enumerations?

Thanks

like image 639
alexn Avatar asked Sep 07 '09 13:09

alexn


2 Answers

I (currently - changes based on project) tend to use this approach when naming assemblies/projects/namespaces in a SAAS/Web style project)

  • CompanyName.
    • ProductName.
      • Data.
      • Business. (references data)
      • Model. (POCO and interfaces - referenced by all)
      • Services. (WCF service layer)
      • ServiceClient. (referenced by web clients)
      • Web. (web client business layer)
        • ViewModel. (view specific model)
        • {client facing product segment} [Commerce, CMS, CRM, Reporting, etc.]

To explain the Services/Service Client...I use an IoC (currently StructureMap) that allows my WebClient to either speak directly to the Business layer or to be redirected to speak through the ServiceClient through Services to the Business layer. This gives me the flexibility to either deploy my app layer to my web applications or to distribute pieces of my business layer (app layer) to different servers by way of WCF/SOA principles.

like image 184
Andrew Siemer Avatar answered Sep 21 '22 03:09

Andrew Siemer


A good practice is to name the folder after the name of the project.

Design Guidelines for Developing Class Libraries has a set of Guidelines for Names

The last item should be of paticular interest for you:

  • Names of Assemblies and DLLs
  • Names of Namespaces
  • Types and Namespaces
like image 28
Alfred Myers Avatar answered Sep 20 '22 03:09

Alfred Myers