Hi Guys
i've read many threads but still cann't really find an optimized solution to the situation i have eventhough it sounds quite simple!
I need a dynamic sitemap that can
1) dynamic refresh when the user changes language/country
2) dynamic add child nodes when the leaf node is selected
A more concrete sample, i have STATIC part of the sitemap which i cache it in sitemap file per country and language:
Department --> By Product --> Category --> Sub Category (leaf node)
Then when the user clicks on Sub category, then it should DYNAMIC retrieve product nodes from DB and add them to the sitemap structure. So each time the sub category is changed the sitemap is need to be reloaded as well as everytime the user change the country and language.
What i have done is create a custom provider, and in BuildSiteMap() method i read a static sitemap file according to which country/language is selected.
Then within BuildSiteMap() i always check if a user has selected or changed a leaf node, then i call the DB to retrive products and add sitemap nodes to the sub category node.
The problem is when the tree is so large, there are too many calls to DB which i get pool size over limit exception, and i found out that the BuildSiteMap() is getting calls like a million times per request!
Moreover if i calls some methods like hasChildNodes, ChildNodes.count within provider then there happened infinite calls and i get stack overflow exception.
How can i....
- dynamiccally update sitemap node structure which probably happens almost for each request?
- the sitemapresolver cann't help me add the sitemap nodes there since the collection is only read-only
- it seems that my situation may not fit well to sitemap provider, maybe should I make a kind of dynamic XmlDataSource which i can keep it cache in memory per request?
- Any suggests to the solution would be really appreciated!!!!
I have a deadline in 2 days...really hope that you guys can help me!
Thanks a lot...
// matt