ASP.NET 2.0 Site Navigation: Site Map Providers

Ecco alcuni estratti / link dalla documentazione.

SPECIFICHE

The StaticSiteMapProvider classes support the concept of a site map provider hierarchy, where a site map provider can have a hierarchical relationship with other site map providers.
This pattern is implemented with the RootProvider and ParentProvider properties.

The site map infrastructure supports displaying site map information based on the user's role. Depending on the
Roles property that are supported by the individual SiteMapNode objects, a different navigation structure can exist for different users. The default implementations of the site map node retrieval members of the StaticSiteMapProvider class perform security trimming automatically by calling the IsAccessibleToUser method.

SPIEGAZIONI

ESEMPI

NOTE PER L'IMPLEMENTAZIONE DI UN CUSTOM PROVIDER DERIVATO DA StaticSiteMapProvider

The StaticSiteMapProvider supplies two additional methods: AddNode and RemoveNode, as well as the abstract BuildSiteMap and protected Clear methods.

The StaticSiteMapProvider class stores its SiteMapNode objects in hash tables and internally uses the SiteMapNode.Url property of the pages, represented by site map nodes, as keys. (If a site map node does not specify a URL, it is tracked using an automatically generated unique key.)

Extending the StaticSiteMapProvider class, the three most important methods are
- GetRootNodeCore,
- Initialize,
- BuildSiteMap.

The
- Clear
- FindSiteMapNode
methods have default implementations that are sufficient for most custom site map provider implementations.

Inizialize
The Initialize method is called to initialize derived site map providers, including any resources that are required to load site map data, but it does attempt to build the site map node in memory. If your derived class is using files to store site map data, any file initialization can be performed here. If the site map node uses some other type of data store, such as a relational database, initializing a connection might be performed here. Additional attributes, such as file names or connection strings that are placed on the site map provider element in the configuration are processed by the ASP.NET configuration system and passed to the Initialize method with the attributes parameter.

BuildSiteMap
The BuildSiteMap method must be overridden by all classes that are derived from the StaticSiteMapProvider class and is called to load the site map node from persistent storage and convert it to an internal representation. The BuildSiteMap method is called internally in many of the default member implementations of the StaticSiteMapProvider and XmlSiteMapProvider classes. If you implement your own site map provider, ensure that site map data processing occurs once and subsequent calls to the BuildSiteMap method return immediately, if site map information has already been loaded. When you implement the BuildSiteMap method, ensure it is thread safe, as multiple concurrent page requests can result indirectly in multiple calls to load site map information.

 

Print | posted @ mercoledì 30 novembre 2005 13:24

Comments on this entry:

Gravatar # 
by .NET slave at 11/12/2007 00:25

Use the provider model in ASP.NET 2.0
Comments have been closed on this topic.