dotnet / dotnet/aspnetcore

Inconsistent namespaces

Open
#55,824 4 comments 0 reactions 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

This happens in quite a few places, some namespaces have the word Abstractions in them, but then others don't.

**Microsoft.Extensions.Caching.Abstractions**
Contains classes with the namespace:
Microsoft.Extensions.Caching.X (no Abstractions in namespace)

**Microsoft.Extensions.Configuration.Abstractions**
Contains classes with the namespace:
Microsoft.Extensions.Configuration.X (no Abstractions in namespace)

**Microsoft.Extensions.Logging.Abstractions**
Contains classes with the namespace:
Microsoft.Extensions.Logging.Abstractions

**Microsoft.Extensions.FileSystemGlobbing.Abstractions**
Contains classes with the namespace:
Microsoft.Extensions.Logging.Abstractions

I think there are 8 namespaces that include the word Abstractions in them.

Is there a reason for this, and if not, is it correct to include the word Abstractions or not?

Also, if Abstractions should be included, where should the positioning of the word be, at the end of the namespace, or at the end of the project name, ie:

Microsoft.Extensions.Logging.AnotherProvider.Abstractions
\- or -
Microsoft.Extensions.Logging.Abstractions.AnotherProvider

Can you provide some guidance on this please?

### Expected Behavior

My personal view is that abstractions should have namespaces with either the word Abstractions in them or not.

I also think either an analyzer rule should be created to avoid this from happening or have some other way to protect against inconsistent namespace rules.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.