I know I will probably get a mixed opinion on this, but I was wondering if there were and "Best Practices" for model naming conventions.
I have a rather large application and I have adopted the following model naming convention:
I was thinking of the following as well:
Which do you prefer, and why?
Do you think it really matters?
Naming Conventions for Name of a Type“ViewModel” is simply added to a “Page”-suffixed name to yield the name of its ViewModel. However, only “Model” is added to a “View”-suffixed name to yield the name of its companion ViewModel.
In ASP.NET MVC, ViewModel is a class that contains the fields which are represented in the strongly-typed view. It is used to pass data from controller to strongly-typed view.
What are the naming conventions to follow in ASP.NET MVC? Controller - Its name must end with “controller” word. Eg. PersonalDetailsController, EmployeesController.
I prefer like {ViewName}{Controller}ViewModel
. I also remove Models
folder, instead I put view models in ViewModels
folder. That makes more sense to me.
eg. AddCategoryViewModel
It doesn't matter. You should name things in a consistent, logical, and straightforward way. Basically, just pick something that makes sense and makes you most productive. Consider how your naming convention would work with IntelliSense.
You might also want to consider how easy your code will be to maintain a year from now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With