Reputation: 24719
Since I basically have a model per view. I arrange my models in sub folders under the model folder after the controller name. /Models/News
.
I have also decided to move my controllers into these folders.
/Models/News/_NewsController.cs
w/ class name still being NewsController
.
I find it easier to locate.
Is this bad practice in any way? Security etc.
Upvotes: 1
Views: 128
Reputation: 10743
This affects nothing as far as I can tell. If this is your personal preference then go for it, it's not a big deal.
Upvotes: 1
Reputation: 1038720
Is this bad practice in any way?
Counter intuitive IMHO and against standard conventions => don't do it unless you consider yourself as the only person that will ever touch this code base and that it is easier for you. Any other developer that will have to do maintenance on it might find it, well, against standard conventions and what he might be used to.
Security?
Unrelated.
Upvotes: 3
Reputation: 2087
You're free to do what you want to do, but this goes against the grain with the purpose of MVC, which is to separate concerns between the model, the view, and the controller. To have it in the Models directory doesn't make much sense because it's not a model. It's a controller. I tend to stick with the convention the framework gives me so there's consistency from project to project and I know exactly where to find my controllers.
Upvotes: 3