Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is best thing to call your namespace in .Net

In the past I've always gone and called my namespace for a particular project the same as the project (and principle class) e.g.:

namespace KeepAlive
{
    public partial class KeepAlive : ServiceBase
    {...

Then from other projects whenever i've called that class its always been:

KeepAlive.KeepAlive()...

I'm now beginning to think that this might not be such a good idea, but I'm sort of stumped what to actually call my namespace. What do other people do? Do you just have one namespace for all your projects?

like image 202
Calanus Avatar asked Nov 29 '22 07:11

Calanus


1 Answers

We have this simple scheme:

  CompanyName.ProductName

Then the application layer, e.g.

  CompanyName.ProductName.Data
  CompanyName.ProductName.Web

etc.

And inside divided per module and/or functionality, which normally correspond to folders

  CompanyName.ProductName.Web.Shop
  CompanyName.ProductName.Web.Newsletter

etc.

BTW: You can find answers to similar questions here:

  • .NET namespaces
  • Should the folders in a solution match the namespace?
like image 153
splattne Avatar answered Dec 05 '22 07:12

splattne