我创建自定义剃刀位置,除了 _ViewImports.cshtml 之外,其他所有功能都正常运行。
这是我的代码:
public class LocationExpander : IViewLocationExpander
{
public void PopulateValues(ViewLocationExpanderContext context)
{
context.Values["customviewlocation"] = nameof(LocationExpander);
}
public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations)
{
var locations = new []
{
$"~/Features/companion object {
@JvmStatic
val DATABASE_NAME = "DataBase"
@JvmField
val database = Room.databaseBuilder(App.context(), DataBase::class.java, DataBase.DATABASE_NAME).build()
}
/Views/{{0}}{RazorViewEngine.ViewExtension}",
$"~/Features/Components/PropertyInfo pInfo = typeof(ScenarioContext).GetProperty("ScenarioExecutionStatus", BindingFlags.Instance | BindingFlags.Public);
MethodInfo getter = pInfo.GetGetMethod(nonPublic: true);
object TestResult = getter.Invoke(ScenarioContext.Current, null);
{RazorViewEngine.ViewExtension}",
$"~/SharedViews/{{0}}{RazorViewEngine.ViewExtension}"
};
return locations.Union(viewLocations);
}
}
是否可以在不为所有视图创建新的_ViewImports.cshtml的情况下为所有剃刀视图在全局文件夹中找到_ViewImports.cshtml的方法?