Last active
May 19, 2022 17:58
-
-
Save scottsauber/797f1471e93de5fde628ef6ef656c6c8 to your computer and use it in GitHub Desktop.
This file contains 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
using System.Collections.Generic; | |
using Microsoft.AspNetCore.Mvc.Razor; | |
namespace FeatureFolderStructureDemo.StartupCustomizations | |
{ | |
public class FeatureLocationExpander : IViewLocationExpander | |
{ | |
public void PopulateValues(ViewLocationExpanderContext context) | |
{ | |
// Don't need anything here, but required by the interface | |
} | |
public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations) | |
{ | |
// The old locations are /Views/{1}/{0}.cshtml and /Views/Shared/{0}.cshtml where {1} is the controller and {0} is the name of the View | |
// Replace /Views with /Features | |
return new string[] {"/Features/{1}/{0}.cshtml", "/Features/Shared/{0}.cshtml"}; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment