Created
August 16, 2018 08:21
-
-
Save usausa/25e183e6ec7e29e9c28a4257e2036fba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LowercaseControllerModelConvention : IControllerModelConvention | |
{ | |
public void Apply(ControllerModel controller) | |
{ | |
controller.ControllerName = controller.ControllerName.ToLower(); | |
foreach (var action in controller.Actions) | |
{ | |
action.ActionName = action.ActionName.ToLower(); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddMvc(options => | |
{ | |
options.Conventions.Add(new LowercaseControllerModelConvention()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment