Vindberg
Vindberg

Reputation: 1542

Namespace Class clash in C# - looking for suggestions

I'm building a generic articles framework and my namespace names are clashing with my entities:

Namespace: MyCompany.Articles.Modules

Class: Articles, Article

Any suggestions to how this can be avoided? According to MS I should use the following format: <Company>.(<Product>|<Technology>)[.<Feature>][.<Subnamespace>].

Thanks.

Upvotes: 0

Views: 572

Answers (1)

Jo&#227;o Angelo
Jo&#227;o Angelo

Reputation: 57658

A simple solution is to rename your Articles class to ArticleCollection, assuming that class is a collection of Article instances.

This convention is consistent with the .NET Framework and is easy to read.


Since the class is being generated automatically a manual rename is not the best solution.

You can change the namespace to something more broader:

[MyCompany].[MyProduct].Dao

or if it spans all the products in the company:

[MyCompany].Common.Dao

where Dao means Data Access Objects.

Upvotes: 6

Related Questions