{"id":175431,"date":"2013-04-29T10:44:03","date_gmt":"2013-04-29T06:44:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=175431"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=175431","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 MvcSiteMapProvider \u0432 ASP.net MVC<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 MvcSiteMapProvider \u0432 ASP.net MVC<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 MvcSiteMapProvider \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0435\u043d\u044e, \u043a\u0430\u043a \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0443 \u0441\u0430\u0439\u0442\u0430 \u0438 \u00abbreadcrumbs\u00bb.<\/p>\n<p>  \u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0432\u0430\u043d\u0438\u044f MvcSiteMapProvider \u044f \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0443\u0447\u0435\u0431\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <a href=\"http:\/\/mvcmusicstore.codeplex.com\/\">MVC Music Store<\/a>.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u0430\u0439\u0442\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f<br \/>  Home<br \/>  Store<br \/>  &nbsp;&nbsp;&nbsp;Rock<br \/>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Best Of Men At Work The Best Of Men At Work <br \/>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For Those About To Rock We Salute You<br \/>  &nbsp;&nbsp;&nbsp;Classical<br \/>  &nbsp;&nbsp;&nbsp;Jazz<br \/>  &nbsp;&nbsp;&nbsp;\u2026<br \/>  Admin<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 MvcSiteMapProvider \u043b\u0435\u0436\u0430\u0442 \u043d\u0430 <a href=\"https:\/\/github.com\/maartenba\/MvcSiteMapProvider\">Github<\/a>, \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u044f MS-PL License.<br \/>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e nuget (\u0412\u0438\u0434-&gt;\u0414\u0440\u0443\u0433\u0438\u0435 \u043e\u043a\u043d\u0430-&gt;\u041a\u043e\u043d\u0441\u043e\u043b\u044c \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0430 \u043f\u0430\u043a\u0435\u0442\u043e\u0432)  <\/p>\n<pre> PM&gt;Install-Package MvcSiteMapProvider <\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 \u043f\u0430\u043f\u043a\u0435 Views\/Shared\/DisplayTemplates \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 view.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/774\/7e0\/bda\/7747e0bda429e43bca6c72b31dfaa668.png\"\/><br \/>  \u041d\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 <i>*.ascx<\/i> \u0444\u0430\u0439\u043b\u044b \u044f \u0443\u0434\u0430\u043b\u0438\u043b.<br \/>  \u0422\u0430\u043a\u0436\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f Mvc.sitemap \u0438 MvcSiteMapSchema.xsd. <br \/>  \u0412 web.config \u0434\u043e\u0431\u0430\u0432\u044f\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438:  <\/p>\n<pre><code class=\"xml\">&lt;siteMap defaultProvider=&quot;MvcSiteMapProvider&quot; enabled=&quot;true&quot;&gt;       &lt;providers&gt;         &lt;clear \/&gt;         &lt;add name=&quot;MvcSiteMapProvider&quot;               type=&quot;MvcSiteMapProvider.DefaultSiteMapProvider, MvcSiteMapProvider&quot;               siteMapFile=&quot;~\/Mvc.Sitemap&quot;               securityTrimmingEnabled=&quot;true&quot;               cacheDuration=&quot;5&quot;               enableLocalization=&quot;true&quot;               scanAssembliesForSiteMapNodes=&quot;true&quot;               includeAssembliesForScan=&quot;&quot;               excludeAssembliesForScan=&quot;&quot;               attributesToIgnore=&quot;visibility&quot;               nodeKeyGenerator=&quot;MvcSiteMapProvider.DefaultNodeKeyGenerator, MvcSiteMapProvider&quot;               controllerTypeResolver=&quot;MvcSiteMapProvider.DefaultControllerTypeResolver, MvcSiteMapProvider&quot;               actionMethodParameterResolver=&quot;MvcSiteMapProvider.DefaultActionMethodParameterResolver, MvcSiteMapProvider&quot;               aclModule=&quot;MvcSiteMapProvider.DefaultAclModule, MvcSiteMapProvider&quot;               siteMapNodeUrlResolver=&quot;MvcSiteMapProvider.DefaultSiteMapNodeUrlResolver, MvcSiteMapProvider&quot;               siteMapNodeVisibilityProvider=&quot;MvcSiteMapProvider.DefaultSiteMapNodeVisibilityProvider, MvcSiteMapProvider&quot;               siteMapProviderEventHandler=&quot;MvcSiteMapProvider.DefaultSiteMapProviderEventHandler, MvcSiteMapProvider&quot; \/&gt;       &lt;\/providers&gt;     &lt;\/siteMap&gt; &lt;\/code&gt; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 Mvc.sitemap, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; &lt;mvcSiteMap xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;             xmlns=&quot;http:\/\/mvcsitemap.codeplex.com\/schemas\/MvcSiteMap-File-3.0&quot;             xsi:schemaLocation=&quot;http:\/\/mvcsitemap.codeplex.com\/schemas\/MvcSiteMap-File-3.0 MvcSiteMapSchema.xsd&quot;             enableLocalization=&quot;true&quot;&gt;   &lt;mvcSiteMapNode title=&quot;Home&quot; controller=&quot;Home&quot; action=&quot;Index&quot;&gt;     &lt;mvcSiteMapNode title=&quot;About&quot; controller=&quot;Home&quot; action=&quot;About&quot;\/&gt;   &lt;\/mvcSiteMapNode&gt; &lt;\/mvcSiteMap&gt; <\/code><\/pre>\n<p>  Xml-\u044d\u043b\u0435\u043c\u0435\u043d\u0442 <b>mvcSiteMapNode<\/b> \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u0430\u0440\u0442\u044b \u0441\u0430\u0439\u0442\u0430. \u0415\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:  <\/p>\n<ul>\n<li><i>title<\/i> \u2014 \u0438\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435<\/li>\n<li><i>controller<\/i> \u2014 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0451\u0440, \u0438\u0437 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430<\/li>\n<li><i>action<\/i> \u2014 \u044d\u043a\u0448\u043d, \u0438\u0437 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430<\/li>\n<li><i>area<\/i> \u2014 \u043e\u0431\u043b\u0430\u0441\u0442\u044c (area), \u0438\u0437 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430<\/li>\n<li><i>dynamicNodeProvider<\/i> \u2014 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 mvcSiteMap, \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0439 \u043d\u043e\u0434\u044b<\/li>\n<li><i>visibility<\/i> \u2014 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u043e\u0434\u044b, \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0440\u0442\u0430 \u0441\u0430\u0439\u0442\u0430 \u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u043d\u044e \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b<\/li>\n<\/ul>\n<p>  \u042f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u043d\u0435\u0433\u043e \u043d\u043e\u0434\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0441\u0430\u0439\u0442\u0430:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; &lt;mvcSiteMap xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;             xmlns=&quot;http:\/\/mvcsitemap.codeplex.com\/schemas\/MvcSiteMap-File-3.0&quot;             xsi:schemaLocation=&quot;http:\/\/mvcsitemap.codeplex.com\/schemas\/MvcSiteMap-File-3.0 MvcSiteMapSchema.xsd&quot;             enableLocalization=&quot;true&quot;&gt;   &lt;mvcSiteMapNode title=&quot;Home&quot; controller=&quot;Home&quot; action=&quot;Index&quot;&gt;     &lt;mvcSiteMapNode title=&quot;Store&quot; controller=&quot;Store&quot; action=&quot;Index&quot;&gt;     &lt;\/mvcSiteMapNode&gt;     &lt;mvcSiteMapNode title=&quot;Cart&quot; controller=&quot;ShoppingCart&quot; action=&quot;Index&quot; \/&gt;     &lt;mvcSiteMapNode title=&quot;Admin&quot; controller=&quot;StoreManager&quot; action=&quot;Index&quot; &gt;     &lt;\/mvcSiteMapNode&gt;   &lt;\/mvcSiteMapNode&gt; &lt;\/mvcSiteMap&gt; <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e 4 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0436\u0430\u043d\u0440\u044b \u0438 \u0430\u043b\u044c\u0431\u043e\u043c\u044b \u0432 \u043a\u0430\u0440\u0442\u0443 \u0441\u0430\u0439\u0442\u0430:  <\/p>\n<ul>\n<li>Rock<br \/> \n<ul>\n<li>The Best Of Men At Work The Best Of Men At Work<\/li>\n<li>For Those About To Rock We Salute You<\/li>\n<li>&#8230;<\/li>\n<\/ul>\n<p>  <\/li>\n<li>Classical<\/li>\n<li>Jazz<\/li>\n<li>&#8230;<\/li>\n<\/ul>\n<p>  \u0422.\u043a. \u0441\u0430\u0439\u0442 \u0443 \u043d\u0430\u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439, \u0442\u043e \u0430\u043b\u044c\u0431\u043e\u043c\u044b \u0438 \u0436\u0430\u043d\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0430 \u0441\u0430\u0439\u0442\u0430 \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 MvcSiteMapProvider \u0435\u0441\u0442\u044c dynamicNodeProvider. \u0418\u0442\u0430\u043a, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0442 <i>DynamicNodeProviderBase <\/i>\u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043c\u0435\u0442\u043e\u0434 <i>GetDynamicNodeCollection<\/i>, \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u0431\u0434:<\/p>\n<pre><code class=\"cs\">public class StoreDynamicNodeProvider : DynamicNodeProviderBase     {         public MusicStoreEntities _db = new MusicStoreEntities();         public override IEnumerable&lt;DynamicNode&gt; GetDynamicNodeCollection()         {             var nodes = new List&lt;DynamicNode&gt;();             var items = _db.Genres.ToList();             foreach (var item in items)             {                 DynamicNode node = new DynamicNode();                 \/\/ \u043a\u043b\u044e\u0447 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043d\u043e\u0434\u044b                 node.Key = &quot;store_&quot; + item.GenreId.ToString();                 node.RouteValues.Add(&quot;genre&quot;, item.Name);                 node.Action = &quot;Browse&quot;;                 node.Controller = &quot;Store&quot;;                 node.Title = item.Name;                 nodes.Add(node);                 if (item.Albums!=null)                 {                     foreach (var item2 in item.Albums)                     {                         DynamicNode node2 = new DynamicNode();                         node2.Key = &quot;album_&quot; + item2.AlbumId.ToString();                         node2.ParentKey = node.Key;                         node2.RouteValues.Add(&quot;id&quot;, item2.AlbumId);                         node2.Action = &quot;Details&quot;;                         node2.Controller = &quot;Store&quot;;                         node2.Title = item2.Title;                         nodes.Add(node2);                     }                 }             }             return nodes;         }     } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 Mvc.sitemap \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u043e\u0434\u0443 Store:  <\/p>\n<pre><code class=\"xml\">&lt;mvcSiteMapNode title=&quot;Store&quot; controller=&quot;Store&quot; action=&quot;Index&quot;&gt;     &lt;mvcSiteMapNode title=&quot;&quot; controller=&quot;Store&quot; action=&quot;Index&quot; dynamicNodeProvider=&quot;MvcMusicStore.Infrastructure.StoreDynamicNodeProvider, MvcMusicStore&quot;\/&gt; &lt;\/mvcSiteMapNode&gt; <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <i>dynamicNodeProvider<\/i>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a \u043a\u043b\u0430\u0441\u0441\u0443-\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0443 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043d\u043e\u0434.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c breadcrumbs \u0432 \u0448\u0430\u0431\u043b\u043e\u043d \u0441\u0430\u0439\u0442\u0430 \u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u043c\u0435\u043d\u044e<br \/>  \u0412 \u0444\u0430\u0439\u043b Views\/Shared\/_Layout.cshtml \u0434\u043e\u0431\u0430\u0432\u0438\u043c:  <\/p>\n<pre><code class=\"html\">    &lt;div style=&quot;text-align: center;&quot;&gt;         \u0412\u044b \u0437\u0434\u0435\u0441\u044c: @Html.MvcSiteMap().SiteMapPath()     &lt;\/div&gt;     @Html.MvcSiteMap().Menu(2, 1) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u0432 \u043b\u0435\u0432\u043e\u043c \u043c\u0435\u043d\u044e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d Views\/Shared\/DisplayTemplates\/MenuHelperModel.cshtml  <\/p>\n<pre><code class=\"html\">&lt;ul id=&quot;menu&quot;&gt;     @foreach (var node in Model.Nodes) {          &lt;li style=&quot;@(node.IsInCurrentPath && !node.IsRootNode ? &quot;text-decoration: underline;&quot; : &quot;&quot;)&quot;&gt;             &lt;a href=&quot;@node.Url&quot;&gt;@node.Title&lt;\/a&gt;         &lt;\/li&gt;     } &lt;\/ul&gt; <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/48d\/a33\/d85\/48da33d85a64e4513714eed0dd741665.png\"\/><\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0430\u0434\u043c\u0438\u043d\u043a\u0435.<br \/>  \u0412 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u044f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435, \u0430 \u043c\u0435\u043d\u044e \u0441\u043b\u0435\u0432\u0430 \u2014 \u043d\u0435\u0442.<br \/>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f:  <\/p>\n<ul>\n<li>Admin<br \/> \n<ul>\n<li>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u043b\u044c\u0431\u043e\u043c\u0430 Facelift<\/li>\n<li>\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0430\u043b\u044c\u0431\u043e\u043c\u0430 Facelift<\/li>\n<li>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0430\u043b\u044c\u0431\u043e\u043c\u0430 Facelift<\/li>\n<li> <i> \u0438 \u0442\u0430\u043a \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u043b\u044c\u0431\u043e\u043c\u0430<\/i><\/li>\n<\/ul>\n<p>   <\/li>\n<\/ul>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0430 Store, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043b\u0430\u0441\u0441 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0442 DynamicNodeProviderBase.<\/p>\n<pre><code class=\"cs\">public class AdminDynamicNodeProvider : DynamicNodeProviderBase     {         public MusicStoreEntities _db = new MusicStoreEntities();         public override IEnumerable&lt;DynamicNode&gt; GetDynamicNodeCollection()         {             var nodes = new List&lt;DynamicNode&gt;();             var items = _db.Albums.ToList();             foreach (var item in items)             {                 var node=new DynamicNode() {                      Key=&quot;admin_album_edit_&quot;+ item.AlbumId.ToString(),                     Action=&quot;Edit&quot;,                     Controller=&quot;StoreManager&quot;,                     Title=&quot;\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u043b\u044c\u0431\u043e\u043c\u0430 &quot;+item.Title                     };                 node.RouteValues.Add(&quot;id&quot;, item.AlbumId);                 nodes.Add(node);                  node = new DynamicNode()                 {                     Key = &quot;admin_album_delete_&quot; + item.AlbumId.ToString(),                     Action = &quot;Delete&quot;,                     Controller = &quot;StoreManager&quot;,                     Title = &quot;\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0430\u043b\u044c\u0431\u043e\u043c\u0430 &quot; + item.Title                 };                 node.RouteValues.Add(&quot;id&quot;, item.AlbumId);                 nodes.Add(node);                  node = new DynamicNode()                 {                     Key = &quot;admin_album_details_&quot; + item.AlbumId.ToString(),                     Action = &quot;Details&quot;,                     Controller = &quot;StoreManager&quot;,                     Title = &quot;\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0430\u043b\u044c\u0431\u043e\u043c\u0430 &quot; + item.Title                 };                 node.RouteValues.Add(&quot;id&quot;, item.AlbumId);                 nodes.Add(node);                              }             return nodes;         }     } <\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043d\u043e\u0434\u0443 Admin:  <\/p>\n<pre><code class=\"xml\">&lt;mvcSiteMapNode title=&quot;Admin&quot; controller=&quot;StoreManager&quot; action=&quot;Index&quot; &gt;   &lt;mvcSiteMapNode title=&quot;&quot; controller=&quot;StoreManager&quot; action=&quot;Index&quot; dynamicNodeProvider=&quot;MvcMusicStore.Infrastructure.AdminDynamicNodeProvider, MvcMusicStore&quot;\/&gt;   &lt;mvcSiteMapNode title=&quot;Create&quot; controller=&quot;StoreManager&quot;  action=&quot;Create&quot; \/&gt; &lt;\/mvcSiteMapNode&gt; <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/002\/0ee\/28b\/0020ee28bea29bf1c2f9c6cceb4ba137.png\"\/><\/p>\n<p>  \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u0440\u044b\u0442\u044c \u0432 \u043c\u0435\u043d\u044e \u0432\u0441\u0435 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0443\u043d\u043a\u0442\u044b, \u043d\u043e \u043f\u0443\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 Mvc.sitemap \u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043d\u043e\u0434\u0430\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <i>visibility=\u00abSiteMapPathHelper,!*\u00bb<\/i>, \u0430 \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b <b>\u0432\u0430\u0436\u043d\u043e<\/b> \u0432 web.config \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0433\u0434\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f Mvc.sitemap \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <i>siteMapNodeVisibilityProvider<\/i> \u043d\u0430 <i>\u00abMvcSiteMapProvider.FilteredSiteMapNodeVisibilityProvider, MvcSiteMapProvider\u00bb<\/i>.<br \/>  \u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0444\u0430\u0439\u043b\u0430 Mvc.sitemap:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; &lt;mvcSiteMap xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;             xmlns=&quot;http:\/\/mvcsitemap.codeplex.com\/schemas\/MvcSiteMap-File-3.0&quot;             xsi:schemaLocation=&quot;http:\/\/mvcsitemap.codeplex.com\/schemas\/MvcSiteMap-File-3.0 MvcSiteMapSchema.xsd&quot;             enableLocalization=&quot;true&quot;&gt;   &lt;mvcSiteMapNode title=&quot;Home&quot; controller=&quot;Home&quot; action=&quot;Index&quot; visibility=&quot;&quot;&gt;     &lt;mvcSiteMapNode title=&quot;Store&quot; controller=&quot;Store&quot; action=&quot;Index&quot;&gt;       &lt;mvcSiteMapNode title=&quot;&quot; controller=&quot;Store&quot; action=&quot;Index&quot; dynamicNodeProvider=&quot;MvcMusicStore.Infrastructure.StoreDynamicNodeProvider, MvcMusicStore&quot;\/&gt;     &lt;\/mvcSiteMapNode&gt;     &lt;mvcSiteMapNode title=&quot;Cart&quot; controller=&quot;ShoppingCart&quot; action=&quot;Index&quot; \/&gt;     &lt;mvcSiteMapNode title=&quot;Admin&quot; controller=&quot;StoreManager&quot; action=&quot;Index&quot; &gt;       &lt;mvcSiteMapNode title=&quot;&quot; controller=&quot;StoreManager&quot; action=&quot;Index&quot; visibility=&quot;SiteMapPathHelper,!*&quot; dynamicNodeProvider=&quot;MvcMusicStore.Infrastructure.AdminDynamicNodeProvider, MvcMusicStore&quot;\/&gt;       &lt;mvcSiteMapNode title=&quot;Create&quot; controller=&quot;StoreManager&quot; visibility=&quot;SiteMapPathHelper,!*&quot; action=&quot;Create&quot; \/&gt;     &lt;\/mvcSiteMapNode&gt;   &lt;\/mvcSiteMapNode&gt; &lt;\/mvcSiteMap&gt; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0451 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/eb1\/9d1\/226\/eb19d1226bdf25d6a5cc8895aa2ebca6.png\"\/><\/p>\n<p>  \u0412\u043e\u0442, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438 \u0432\u0441\u0451.<br \/>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c <a href=\"http:\/\/slrz.ru\/MvcMusicStore-w-SiteMap.zip\">\u0437\u0434\u0435\u0441\u044c<\/a>    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/175431\/\"> http:\/\/habrahabr.ru\/post\/175431\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 MvcSiteMapProvider \u0432 ASP.net MVC<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 MvcSiteMapProvider \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0435\u043d\u044e, \u043a\u0430\u043a \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0443 \u0441\u0430\u0439\u0442\u0430 \u0438 \u00abbreadcrumbs\u00bb.<\/p>\n<p>  \u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0432\u0430\u043d\u0438\u044f MvcSiteMapProvider \u044f \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0443\u0447\u0435\u0431\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <a href=\"http:\/\/mvcmusicstore.codeplex.com\/\">MVC Music Store<\/a>.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-175431","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/175431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=175431"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/175431\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=175431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=175431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=175431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}