IViewLocationExpander无法解析_viewImports

时间:2018-06-24 07:38:48

标签: c# asp.net-core

我创建自定义剃刀位置,除了 _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的方法?

0 个答案:

没有答案