ASP.NET MVC Routing Naming Conventions

From Rails and some ASP.NET MVC examples, I got the feeling that routes are mostly lowercase. C # conventions require uppercase and lowercase uppercase names, so the controllers and controller actions will remain in uppercase, but I wonder if I should start writing routes in global.asax.cs in all lowercase (unlike what I'm doing now, namely in upper case).

it

routes.MapRoute("GetPosts", "PostCode/GetPosts", new { controller = "PostCode", action = "GetPosts" });

or

routes.MapRoute("GetPosts", "PostCode/GetPosts", new { controller = "PostCode", action = "GetPosts" });

or

routes.MapRoute("posts", "postcode/posts", new { controller = "PostCode", action = "GetPosts" });

or something else?

+3
source share
2 answers

I prefer the camel case for the route name and url template as it is in your first example.

, . MyRouteNames.Posts MyRouteNames.GetPosts .

+3

. , , , , / .

0

Source: https://habr.com/ru/post/1766055/


All Articles