【问题标题】:How NopCommerce loads admin areaNopCommerce 如何加载管理区域
【发布时间】:2016-09-20 06:03:30
【问题描述】:

这个问题很简单。 NopCommerce web 项目 (Nop.Web) 如何加载 Admin 区域,而它单独位于另一个 DLL 放置在根项目 bin 目录中?

我在AutoFac 附近工作过,但似乎与此无关。

【问题讨论】:

  • 看,Nop.WebAdministration 文件夹和Nop.Admin 输出路径是Nop.Web > bin
  • 是的@Div,它发布在bin 文件夹中,但是Nop.Web.dll 如何找到并加载它?
  • 我的项目是基于 NopCommerce 的,所以问题直接关系到 Nop 的基础设施
  • 我的项目是基于NopCommerce的 nopCommerce是基于ASP.NET的,所以问题是直接关系到Nop的基础设施不,直接关系到@ 987654322@
  • 参考上面的链接,有一个说法你可以将编译好的程序集存放在Bin文件夹中,其他代码在web应用的任何地方(比如pages的代码) ) 自动引用它

标签: asp.net-mvc mef nopcommerce


【解决方案1】:

从 Nop.Web 打开 Global.asax.cs,然后在方法中看到 Application_Start,你可以看到那里有一行

AreaRegistration.RegisterAllAreas();

通过这一行,它注册了您域的所有区域。

RegisterAllAreas 方法查找应用程序域中派生自 AreaRegistration 的所有类型,并调用它们的每个 RegisterArea 方法。

更多信息请查看link.

【讨论】:

  • 感谢@Anik,这就是我想要的。但似乎 Nop 开发人员更改了ThemeableRazorViewEngine.cs 中的一些规则,因为~/adminAdministration/Views 加载视图而不是~/areas/Admin/Views
  • ThemeableVirtualPathProviderViewEngine.cs 会更好,这样你可以更好的理解。您可以在 nopcommerce 论坛中与 Mr.Andrei 交谈,他一定会帮助您更清楚地了解 nopcommerce 结构。
  • 其实你能看到这个方法受保护的虚拟字符串GetPath(ControllerContext controllerContext, string[] locations, string[] areaLocations, string locationsPropertyName, string name, string controllerName, string theme, string cacheKeyPrefix, bool useCache, out string[] searchedLocations)
猜你喜欢
  • 2013-03-14
  • 1970-01-01
  • 2012-07-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-12
  • 1970-01-01
相关资源
最近更新 更多