-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserving values from nested DyanmicNodeProviders #277
Comments
I think what you are after is the buggy nested dynamic recursion behavior that existed in v3, although I never thought I would have anyone ask for it. You can enable that behavior with the configuration setting in web.config, although I don't recommend it. <appSettings>
<add key="MvcSiteMapProvider_EnableSiteMapFileNestedDynamicNodeRecursion" value="false"/>
</appSettings> This causes the child dynamic node provider to be called N+1 times, where N is the number of nodes returned from the parent dynamic node provider. Don't ask me what the +1 is for, I couldn't figure that out. This was a major source of performance issues in v3. Before you do that though, there is a better option for this use case that could eliminate the need for the dynamic node provider entirely. You can only use this if you don't intend the pages to be indexed by search engines and don't want all of your child items to appear in the menu, but fortunately for administration pages (CRUD operations) that is the normal case. You can just declare a single set of nodes in your XML with the preservedRouteParamters element set to the id and then this single set of nodes will always match every record in your database. You then need to use the SiteMapTitleAttribute to fix the title and the FilteredSiteMapNodeVisibilityProvider to fix the visibility on the menu. There is a whole blog post about this as well as a downloadable working demo that explores these options titled How to Make MvcSiteMapProvider Remember a User's Position. |
Actually that's exactly what I wanted to hear. I'm currently doing a big upgrade from a heavily abused v3, in fact there are a lot of places I currently do things the way you mentioned for performance reasons but thought it was not a recommended method vs DynamicNodeProviders. As performance was mentioned as something that's improved in recent versions and that large numbers of nodes were not an issue I thought I'd change this around. Looks like I'm fine not making this change anyway. |
Well, there is still a hard limit on the number of nodes that I plan to work on in v5 (see #258). I wouldn't recommend using more than about 10,000-15,000 nodes total in v4. Fortunately, that is enough for most people and using preservedRouteParameters can reduce the number in a lot of scenarios. |
Yeah I was hitting that on profile view pages alone. Was worried for when I I'm currently handling the search engine sitemaps by adding them in to
|
I have a sitemap where a person can have multiple roles along the following lines:
In order to get a map like:
DirectoryPersonProvider
Works fine, it queries the database and inserts nodes adding a personid routevalue for each. WhenDirectoryPersonRoleProvider
runs I want to be able to query for all roles for a person but I can't find anyway to get the personid out of the parent node the provider is given. I've tried combinations of inherit or preserve route values but nothing seems to work. I thinkDirectoryPersonRoleProvider
is running once per XML sitemap element rather than once per node generated byDirectoryPersonProvider
.Worst comes to worst I can generate the whole tree from
DirectoryPersonProvider
but this takes a lot of the nodes out of the XML file.The text was updated successfully, but these errors were encountered: