XML .NET . node (, ) XML. .NET - XML, XML node .
DI:
<appSettings>
<add key="MvcSiteMapProvider_EnableSiteMapFile" value="false"/>
</appSettings>
DI ( StructureMap):
var siteMapNodeProvider = this.For<ISiteMapNodeProvider>().Use<CompositeSiteMapNodeProvider>()
.EnumerableOf<ISiteMapNodeProvider>().Contains(x =>
{
x.Type<ReflectionSiteMapNodeProvider>()
.Ctor<IEnumerable<string>>("includeAssemblies").Is(includeAssembliesForScan)
.Ctor<IEnumerable<string>>("excludeAssemblies").Is(new string[0]);
});
, IncludeAssembliesForScan. , NuGet , MvcSiteMapProvider, , MVC, .
DI:
<appSettings>
<add key="MvcSiteMapProvider_IncludeAssembliesForScan" value="MyAssembly,MyOtherAssembly"/>
</appSettings>
DI:
string[] includeAssembliesForScan = new string[] { "MyAssembly", "MyOtherAssembly" };
... Other code omitted ...
var siteMapNodeProvider = this.For<ISiteMapNodeProvider>().Use<CompositeSiteMapNodeProvider>()
.EnumerableOf<ISiteMapNodeProvider>().Contains(x =>
{
x.Type<ReflectionSiteMapNodeProvider>()
.Ctor<IEnumerable<string>>("includeAssemblies").Is(includeAssembliesForScan)
.Ctor<IEnumerable<string>>("excludeAssemblies").Is(new string[0]);
});
, , AttributeRouting. MvcSiteMapProvider , MVC, .
, , , PreservedRouteParameters , , .
[Route(@"~/account-management/{id:int}/{domain:regex(^([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$)}", Name = "AccountDetail")]
[MvcSiteMapNode(Title = "Account Detail", ParentKey = "AccountIndex", Key = "AccountDetail", PreservedRouteParameters="domain,id")]
public ActionResult Details(string domain, int id) {
return View();
}
. , , RouteParameters , , . , , MvcSiteMapProvider node . , - ( node), . . MvcSiteMapProvider .
. , , v4.6.15, - DI IStringLocalizer.
, App_GlobalResources. , MVC, , MVC. , .