ASP.NET MVC 2 area namespace assignment
-
24-09-2019 - |
Question
Suppose the root project has My.Root.Project
namespace. I wonder what namespace should be assigned to an area classes? Possible alternatives:
My.Root.Project.Areas.Area1
My.Root.Project.Area1
Esthetically, I prefer second one.
However, since I use a single-project areas, all the classes created within Areas\Area1\...
folder are given long namespace My.Root.Project.Areas.Area1
by default. There is too much stupid work in getting rid of the Areas
part in every created class by hands.
How to prevent Areas
from being included into namespace?
Solution
I personally like the second one.
I think that you can do one of the following things:
If this is a stand alone project you can call him whatever name you want.
If this is a folder in another project, in the properties of the areas folder you can choose: Namespace Provider: False.