Could someone explain ASP.NET Convention Based Naming and provide some examples if possible please
Could someone explain ASP.NET Convention Based Naming and provide some examples if possible please
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Convention-based naming is essentially a way to reduce the amount of explicit code you have to write by defining a set of convention mappings so that, for example, pages whose names match a certain format will be automatically looked for within a certain directory.
There’s an article here which has some examples (have a search for ‘Convention-based naming and the \Views directory structure‘) and another from the same series here.
There’s another, more concise example here: ASP.NET MVC: When convention really matters.
In that example, calling
return View("NotFound");from theDinnersControllerclass will automatically look for a View calledNotFoundin the\Views\Dinners\directory, without you needing to explicitly define that directory structure when you callView().The convention in this instance determines the location of the
Viewbased on the name of theController.