siteMapBuilderService needs an overload of AddNode method

Topics: Web Client Software Factory, UIP Application Block discussion, User Forum
Jun 26, 2007 at 3:17 PM
Dear All,
I have a requirement where I need to add a Node to a ParentNode that has been added by another module. But siteMapBuilderService does not give me a way to add my node to an already existing parent created by some other module. Is there some way to achieve this? One way is to provide an overload of AddNode that takes ParentNode as a string instead of SiteMapNodeInfo for e.g.
siteMapBuilderService.AddNode(oNode, "Home"); where Home is a ParentNode key added previously by some other module. Is there a better way to achieve this? To do this I need to create a siteMapBuilderService class derived from SiteMapBuilderService and give an overload on AddNode. Please suggest.

Thanks & regards
Sunil
Developer
Jun 29, 2007 at 7:04 PM
Hi Sunil, you are in the right way, you can extend the SiteMapBuilderService deriving from them.

I want to point you something, if you create your custom SiteMapBuilderService, don’t forget to register it.

You are have to change the following in the AddGlobalServices method from the ShellModuleInitializer:
services.AddNew<SiteMapBuilderService, ISiteMapBuilderService>();
to this:
services.AddNew<CustomSiteMapBuilderService, ISiteMapBuilderService>();   
Also have in mind that you have to cast the result of moduleContainer.Services.Get<ISiteMapBuilderService>(true) to your class, because the interface is not going to have your new method.

Let me know if this helps,

Ezequiel Jadib
http://staff.southworks.net/blogs/ejadib