how to provide titles based on route values?

May 16, 2011 at 9:56 AM
Edited May 16, 2011 at 10:00 AM

Hi!

For the first i have to say big thanks to author of the project, terrific job, thanks!

So about the site map ... we have a DB with a deep structure (4-5 levels) and lots of data. We are using currently standard dynamic node provider, that loads all data at startup (Customer-Program-Certificate-Test-question-answers.).

After user updates some data, in order to display right name, we need to reload ALL nodes, this became an issue because of lots of data.

So two questions, how can we update particular node (for updated object), or how can we resolve node title dynamically on page rendering (ie touch db and provide titles based on route values)? It would be really cool to have such feature, so developer could choose to loads all data at startup or provide titles per request.

    public class CustomerNodeProvider :  DynamicNodeProviderBase

    {
        public override IEnumerable<DynamicNode> GetDynamicNodeCollection()
        {
            ICustomerManager manager = // get customer manager;
            List<DynamicNode> result = new List<DynamicNode>();

            foreach (ICustomer customer in manager.GetCustomers().ToList())
            {
                DynamicNode dynamicNode = new DynamicNode()
                                              {
                                                  Title = customer.Name,
                                                  Controller = "Customer",
                                                Action = "View",
                                                  RouteValues = new Dictionary<string, object>() { { "clientId", customer.Id } }
                                              };

                result.Add(dynamicNode);

                result.Add(new DynamicNode()
                {
                    Title = customer.Name,
                    Controller = "Customer",
                    Action = "Edit",
                    RouteValues = new Dictionary<string, object>() { { "clientId", customer.Id } }
                });
                result.Add(new DynamicNode()
                {
                    Title = customer.Name,
                    Controller = "Customer",
                    Action = "Remscme",
                    Key = "Cust_" + customer.Id,
                    RouteValues = new Dictionary<string, object>() { { "clientId", customer.Id } }
                });
            }
            return result;
        }
    }

Coordinator
May 26, 2011 at 2:14 PM

We've had this request before, but it's difficult to implement in a simple and logical manner. Whe nshould we call back to your code to ask for updated titles? Will it only be the title of 1 node, of 3 nodes or of all nodes? Will it also be other properties and not only the title?

In short: if we implemented this mechanism, how would you like to be able to use it?