OracleSiteMapProvider Class

This class allows ASP.NET applications to retrieve site map information from an Oracle database.

Class Inheritance

System.Object

  System.Configuration.Provider.ProviderBase

    System.Web.SiteMapProvider

      System.Web.StaticSiteMapProvider

        Oracle.Web.SiteMap.OracleSiteMapProvider

Declaration

// C#
Public class OracleSiteMapProvider: StaticSiteMapProvider, IDisposable

Thread Safety

All public static methods are thread-safe, although instance members are not guaranteed to be thread-safe.

Remarks

This class allows ASP.NET applications to read and load site map information from an Oracle database.

Examples

The following is a web.config example for an ASP.NET application that uses OracleSiteMapProvider as the default provider. This configuration uses the connection string and default attribute values specified in the machine.config file.

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <system.web>
    <siteMap defaultProvider="OracleSiteMapProvider"/>
  </system.web>
</configuration>

The following is a web.config example for an ASP.NET application that uses OracleSiteMapProvider as the default provider, with customized settings and an application-specific connection string:

<?xml version="1.0"?>
<configuration xmlns=
  "http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <connectionStrings>
    <add name="my_sitemap_app_con_string" connectionString=
      "User Id=scott;Password=tiger;Data Source=Oracle"/>
  </connectionStrings>
  <system.web>
    <!-- Enable and customize OracleSiteMapProvider -->
    <siteMap defaultProvider="CustomOracleSiteMapProvider">
      <providers>
        <add name="CustomOracleSiteMapProvider"
             type="Oracle.Web.SiteMap.OracleSiteMapProvider,
                   Oracle.Web, Version=2.112.2.0, Culture=neutral,
                   PublicKeyToken=89b483f429c47342"
             connectionStringName="my_sitemap_app_con_string"
             applicationName="my_sitemap_app"
             securityTrimmingEnabled="false"/>
      </providers>
    </siteMap>
  </system.web>
</configuration>

Note that the applicationName attribute should be set to a unique value for each ASP.NET application.

Requirements

Namespace: Oracle.Web.SiteMap

Assembly: Oracle.Web.dll

Oracle Providers for ASP.NET Version: Oracle Providers for ASP.NET 2.0 and Oracle Providers for ASP.NET 4

OracleSiteMapProvider requires the Change Notification privilege with Oracle Database 10g release 2 (10.2)and later.


OracleSiteMapProvider Members

OracleSiteMapProvider members are listed in the following tables.

OracleSiteMapProvider Constructors

The OracleSiteMapProvider constructor is listed in Table 4-1.

Table 4-1 OracleSiteMapProvider Constructor

Constructor Description

OracleSiteMapProvider Constructors

Instantiates a new instance of the OracleSiteMapProvider class


OracleSiteMapProvider Static Methods

OracleSiteMapProvider static methods are listed in Table 4-2.

Table 4-2 OracleSiteMapProvider Static Methods

Static Methods Description

Equals

Inherited from System.Object (Overloaded)

ReferenceEquals

Inherited from System.Object


OracleSiteMapProvider Public Properties

OracleSiteMapProvider public properties are listed in Table 4-3.

Table 4-3 OracleSiteMapProvider Public Properties

Public Properties Description

ApplicationName

Gets or sets the name of the application that differentiates site map data for different applications

CommandTimeout

Gets the number of seconds that the command is allowed to execute before it is terminated with an exception

CurrentNode

Inherited from System.Web.SiteMapProvider (Read-Only)

Description

Inherited from System.Configuration.Provider.Providerbase

EnableLocalization

Inherited from System.Web.SiteMapProvider

Name

Inherited from System.Configuration.Provider.Providerbase

ParentProvider

Inherited from System.Web.SiteMapProvider

ResourceKey

Inherited from System.Web.SiteMapProvider

RootNode

Inherited from System.Web.SiteMapProvider (Read-Only)

RootProvider

Inherited from System.Web.SiteMapProvider

SecurityTrimmingEnabled

Inherited from System.Web.SiteMapProvider


OracleSiteMapProvider Public Methods

OracleSiteMapProvider public methods are listed in Table 4-4.

Table 4-4 OracleSiteMapProvider Public Methods

Public Methods Description

BuildSiteMap

Builds a SiteMap tree of the SiteMapNode objects by loading site map data from an Oracle database

Dispose

Releases all the resources for this instance

FindSiteMapNode

Inherited from System.Web.StaticSiteMapProvider

FindSiteMapNodeFromKey

Inherited from System.Web.StaticSiteMapProvider

GetChildNodes

Inherited from System.Web.StaticSiteMapProvider

GetCurrentNodeAndHintAncestorNodes

Inherited from System.Web.SiteMapProvider

GetCurrentNodeAndHintNeighborhoodNodes

Inherited from System.Web.SiteMapProvider

GetParentNode

Inherited from System.Web.StaticSiteMapProvider

GetParentNodeRelativeToCurrentNodeAndHintDownFromParent

Inherited from System.Web.SiteMapProvider

GetParentNodeRelativeToNodeAndHintDownFromParent

Inherited from System.Web.SiteMapProvider

HintAncestorNodes

Inherited from System.Web.SiteMapProvider

IsAccessibleToUser

Inherited from System.Web.SiteMapProvider

GetHashCode

Inherited from System.Object

GetType

Inherited from System.Object

Initialize

Initializes the OracleSiteMapProvider instance with the property values specified in the ASP.NET application configuration file

ToString

Inherited from System.Object



OracleSiteMapProvider Constructors

This constructor instantiates a new instance of the OracleSiteMapProvider class.

Overload List:

OracleSiteMapProvider()

This constructor instantiates a new instance of the OracleSiteMapProvider class.

Declaration

// C#
public OracleSiteMapProvider();

Remarks

The OracleSiteMapProvider constructor is called by ASP.NET to create an instance of the OracleSiteMapProvider class as specified in the configuration file for the application. Initialization values for the OracleSiteMapProvider object are passed through the Initialize method.

This constructor is not intended to be used directly by the application.


OracleSiteMapProvider Static Methods

OracleSiteMapProvider static methods are listed in Table 4-5.

Table 4-5 OracleSiteMapProvider Static Methods

Static Methods Description

Equals

Inherited from System.Object (Overloaded)

ReferenceEquals

Inherited from System.Object



OracleSiteMapProvider Public Properties

OracleSiteMapProvider public properties are listed in Table 4-6.

Table 4-6 OracleSiteMapProvider Public Properties

Public Properties Description

ApplicationName

Gets or sets the name of the application that differentiates site map data for different applications

CommandTimeout

Gets the number of seconds that the command is allowed to execute before it is terminated with an exception

CurrentNode

Inherited from System.Web.SiteMapProvider

Description

Inherited from System.Configuration.Provider.Providerbase

EnableLocalization

Inherited from System.Web.SiteMapProvider

Name

Inherited from System.Configuration.Provider.Providerbase

ParentProvider

Inherited from System.Web.SiteMapProvider

ResourceKey

Inherited from System.Web.SiteMapProvider

RootNode

Inherited from System.Web.SiteMapProvider

RootProvider

Inherited from System.Web.SiteMapProvider

SecurityTrimmingEnabled

Inherited from System.Web.SiteMapProvider


ApplicationName

This property gets or sets the name of the application that differentiates site map data for different applications.

Declaration

// C#
public string ApplicationName{get; set;}

Property Value

The name of the application. If the applicationName attribute is not specified in the application configuration file, or if the value is an empty string, then this property is set to the application virtual path.

Exceptions

HttpException - The ApplicationName property was set by a user that does not have high ASP.NET hosting permission.

System.Configuration.Provider.ProviderException - The application name supplied exceeds 256 characters.

ArgumentException - The application name supplied is an empty string or a null reference.

Remarks

The string value of the ApplicationName property is used for organizing user information.

Multiple ASP.NET applications can use the same data source and create duplicate user names because user information is stored uniquely for each application name. This property can be set programmatically, or it can be set declaratively in the configuration file for the Web application using the applicationName attribute. The attribute name in the configuration file is case-sensitive.

The ApplicationName property is not thread-safe. It is recommended that program code not allow users to set the ApplicationName property in Web applications.

CommandTimeout

This property gets the number of seconds that the command is allowed to execute before it is terminated with an exception.

Declaration

// C#
public int CommandTimeout {get;}
 

Property Value

An int.

Remarks

To customize a provider, ASP.NET developers can set an integer value for this property through the web.config file using the commandTimeout attribute.

The default value is 30 seconds. The attribute name in the configuration file is case-sensitive.


OracleSiteMapProvider Public Methods

OracleSiteMapProvider public methods are listed in Table 4-7.

Table 4-7 OracleSiteMapProvider Public Methods

Public Methods Description

BuildSiteMap

Builds a SiteMap tree of the SiteMapNode objects by loading site map data from an Oracle database

Dispose

Releases all the resources for this instance

FindSiteMapNode

Inherited from System.Web.StaticSiteMapProvider

FindSiteMapNodeFromKey

Inherited from System.Web.StaticSiteMapProvider

GetChildNodes

Inherited from System.Web.StaticSiteMapProvider

GetCurrentNodeAndHintAncestorNodes

Inherited from System.Web.SiteMapProvider

GetCurrentNodeAndHintNeighborhoodNodes

Inherited from System.Web.SiteMapProvider

GetParentNode

Inherited from System.Web.StaticSiteMapProvider

GetParentNodeRelativeToCurrentNodeAndHintDownFromParent

Inherited from System.Web.SiteMapProvider

GetParentNodeRelativeToNodeAndHintDownFromParent

Inherited from System.Web.SiteMapProvider

HintAncestorNodes

Inherited from System.Web.SiteMapProvider

IsAccessibleToUser

Inherited from System.Web.SiteMapProvider

GetHashCode

Inherited from System.Object

GetType

Inherited from System.Object

Initialize

Initializes the OracleSiteMapProvider instance with the property values specified in the ASP.NET application's configuration file

ToString

Inherited from System.Object


BuildSiteMap

This method builds a SiteMap tree of the SiteMapNode objects by loading site map data from the Oracle database.

Declaration

// C#
Public override SiteMapNode BuildSiteMap();

Return Value

The root SiteMapNode of the site map navigation structure.

Exceptions

InvalidOperationException - The OracleSiteMapProvider instance is not initialized.

ProviderException - One of the following conditions exists:

  • Root node is not found.

  • Multiple root nodes are found.

  • Parent node is not found for any node.

ConfigurationErrorsException - One of the following conditions exists:

  • The roles of the SiteMapNode contain characters that are not valid.

  • A URL is parsed for a SiteMapNode that is not unique.

  • A SiteMapNode object was encountered with a duplicate value for Key.

  • An error occurred while parsing the URL of a SiteMapNode.

Remarks

This method fetches site map data from the database and builds a tree of site map nodes in memory. The OracleSiteMapProvider object could choose to subscribe to database change notifications to get notified about the changes in the site map data in the database. This method is thread-safe.

Dispose

This method releases all the resources for this instance.

Declaration

// C#
public override void Dispose();

Remarks

This method releases all the resources for this instance when the application domain is closed.

Initialize

This method initializes the OracleSiteMapProvider instance with the property values specified in the ASP.NET application configuration file (web.config).

Declaration

// C#
Public override void Initialize(string name, NameValueCollection config);

Parameters

  • name

    The name of the OracleSiteMapProvider instance to initialize.

  • config

    A Systems.Collections.Specialized.NameValueCollection object that contains the names and values of configuration options for the site map provider.

Exceptions

ArgumentNullException - The config parameter is null.

InvalidOperationException - A SiteMapProvider is already initialized.

ProviderException - One of the following exists:

  • The connectionStringName attribute is null or empty in the configuration file.

  • The connection string corresponding to the value of the connectionStringName attribute is null or empty.

  • The configuration file contains an unrecognized attribute.

  • An error occurred during initialization of the provider.

Remarks

The Initialize method is not intended to be called directly by the application.