nopcommerce 3.5通用网址引擎

时间:2015-03-23 21:37:58

标签: nopcommerce

我正在寻找nopcommerce 3.50的引擎根实现,对我来说有一些神秘的东西。 在Nop.Web项目中,"基础设施" directory包含GenericUrlRouteProvider类,它为通用URL注册root。 这堂课对我来说是个谜,因为我不明白nopcommerce是如何区分网址的。

我举了一个例子:

- >如果您在浏览器中写下此网址:http://localhost:15536/books - >它会重定向到" book"类别派发书。

- >如果您在浏览器中写下此网址:http://localhost:15536/cooking-for-two - >它会重定向项目的产品页面"烹饪为2"

这是2个diifferens内容和页面,但这是完全相同的根定义:

        routes.MapLocalizedRoute("Product",
                                 "{SeName}",
                                 new { controller = "Product", action = "ProductDetails" },
                                 new[] {"Nop.Web.Controllers"});

        routes.MapLocalizedRoute("Category",
                        "{SeName}",
                        new { controller = "Catalog", action = "Category" },
                        new[] { "Nop.Web.Controllers" });

我的问题是,当您致电http://localhost:15536/bookshttp://localhost:15536/cooking-for-two时,nopcommerce如何确定执行哪个根(操作和控制器)?

1 个答案:

答案 0 :(得分:2)

如果您有数据库访问权限,您会看到有一个表'[dbo]。[UrlRecord]'

执行以下查询

SELECT  [Id]
      ,[EntityId]
      ,[EntityName]
      ,[Slug]
      ,[IsActive]
      ,[LanguageId]
  FROM [dbo].[UrlRecord]

查询结果。

实施例: 1)Slug:cook-for-two,EntityName:Product and EntityId:22,

2)Slug:books,EntityName:Category,EntityId:1

基于EntityName和EntityId系统路由到相应的控制器操作和id

有关详细信息,请参阅:http://www.pronopcommerce.com/nopcommerce-id-less-url-structure-demystified-how-does-nopcommerce-270-and-280-resolve-urls