如何正确实现EmbeddedResource _ViewImports&插件中的_ViewStart

时间:2018-02-07 16:47:17

标签: aspnetboilerplate

我想创建嵌入式_ViewImports文件,该文件为特定于插件的视图设置使用,继承(更改本地化源)。问题是当我包含这样的嵌入式视图时

Configuration.EmbeddedResources.Sources.Add(
    new EmbeddedResourceSet(
        "/Views/",
        Assembly.GetExecutingAssembly(),
        "MyPlugin.Web.Views"
    )
);

然后,此插件的View文件夹中的_ViewImports.cshtml将覆盖整个站点的所有其他文件夹。我需要做什么才能将其范围仅限于插件中的视图?

1 个答案:

答案 0 :(得分:1)

Asp.net核心已经有一项功能What is the LD_PRELOAD trick?

你需要使用Area来限制它!