Namespaces and folder structures in c# solutions: how should folders on disk be organised?

前端 未结 8 737
野趣味
野趣味 2021-02-04 06:26

First off, let’s agree that namespace should match folder structure and that each language artefact should be in its own file.

(see Should the folders in a solution ma

8条回答
  •  误落风尘
    2021-02-04 06:40

    I prefer a flat structure with projects in the root.

    • MyCorp.Core
    • MyApp.Domain
    • MyApp.Data
    • MyApp.UI
    • MyApp.Test

    Inside of these I have various folders and namespaces. I only create different assemblies for deployable units. Small apps won't even have this amount of separation. IMO this keeps things simple. If I ever decide that code I have needs to be used elsewhere, it's easy enough to break it into an assembly if needed, as long as I've followed good namespacing practices.

提交回复
热议问题