Microsoft.Web.Management.DatabaseManager Namespace

The Microsoft.Web.Management.DatabaseManager namespace contains classes that a developer can use to build a provider to manage a database by using IIS Manager. Administrators can use this provider and the IIS Manager interface to remotely manage a database over the Internet.

The classes in the Microsoft.Web.Management.DatabaseManager namespace contain a series of top-level objects that let developers create providers that enable remote database administration tasks by using IIS Manager. The different logical objects represent the various database objects, including tables, views, stored procedures, columns, keys, and indexes. You can use the API to obtain and work with these objects to perform such actions as creating, deleting, or modifying tables, views, stored procedures, columns, keys, and indexes.

Notes for Implementers

After you have created a database provider, you must register it in the Global Assembly Cache for your server, and then register it in your Administration.config file before IIS Manager will recognize the provider. The following XML example illustrates a database provider registration from an Administration.config file.

<system.webServer>
   <management>
      <dbManager>
         <DBProviders>
            <provider
                  name="SQL Server 2005/2008"
                  providerName="System.Data.SqlClient"
                  type="Microsoft.Web.Management.DatabaseManager.SqlDatabase.SqlDatabaseProvider, Microsoft.Web.Management.DatabaseManager.SqlDatabase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" >
               <databaseBackup
                  backupEnabled="true"
                  restoreEnabled="true"
                  backupPath="C:\backups" />
            </provider>
         </DBProviders>
      </dbManager>
      </management>
</system.webServer>

There are three attributes that your database provider must specify in the <provider> element before the database manager will recognize your database provider and display databases in IIS Manager. These attributes are listed in the following table:

Parameter

Description

name

(Required) A string that contains the friendly name for your provider.

providerName

(Required) A string that contains the name of the .NET provider for your specific database. For example, you might specify System.Data.SqlClient for Microsoft SQL Server, or System.Data.OleDb for an OLEDB database.

type

(Required) The managed type for your database provider.

Depending on your implementation, there are three additional attributes that your database provider may specify in the <databaseBackup> element before the database manager will display the backup and restore options in IIS Manager. These attributes are listed in the following table:

Parameter

Description

backupPath

(Optional) A string that contains the path where the database manager will store database backup files.

backupEnabled

(Optional) true if your provider supports backing up databases; otherwise, false.

restoreEnabled

(Optional) true if your provider supports restoring databases; otherwise, false.

The backupPath attribute may contain variables that IIS Manager will expand to their respective string equivalents. These variable names are case sensitive, and their descriptions are listed in the following table:

Variable Names

Description

{userName}

The current user's account name.

{userDomain}

The name of the domain where the current user's account name is located.

{site}

The name of the current site.

{appPath}

The name of the current application.

These variables are useful in an environment where multiple servers are storing backups in a common repository, such as a network location. For example, you could use a path such as \\server\share\{site}, so that multiple servers can share the same storage location, while being separated into unique folders by their respective site names.

Classes

  Class Description
Public class Column Represents a column within a database.
Public class ColumnDataInfo Represents the information about the data in a column within the database that is being managed.
Public class ConnectionArgument Specifies a connection argument for a database connection.
Public class DatabaseInfo Represents the class that contains database-specific information for a provider.
Public class DatabaseProvider Represents the base class that needs to be implemented in order to manage a database.
Public class DependenciesMissingException
Public class ForeignKey Represents a foreign key within a database.
Public class ForeignKeyColumn Represents a foreign key column within a database.
Public class Index Represents an index within a database.
Public class IndexColumn Represents an index column within a database.
Public class Query Represents a database query.
Public class QueryColumnMetadata Represents the metadata for a column within a query result.
Public class QueryResult Represents a query result that was returned from a database query.
Public class StoredProcedure Represents a stored procedure within a database.
Public class StoredProcedureParameter Represents a parameter for a stored procedure within a database.
Public class Table Represents a table within a database.
Public class TableInfo Represents the information for a table within a database.
Public class TypeInfo Represents data type information within a database.
Public class View Represents a view within a database.

Interfaces

  Interface Description
Public interface IDbBackupManager Represents a database backup manager interface.
Public interface IDbCustomBackupRestoreManager Represents a custom database backup and restore manager interface.
Public interface IDbRestoreManager Represents a database restore manager interface.
Public interface IDbStoredProcedureManager Represents a stored procedure manager interface for a database provider.
Public interface IDbTableDataManager Represents a table data manager interface within a database provider.
Public interface IDbTableManager Represents a table manager interface for the database provider.
Public interface IDbViewManager Represents a view manager interface within a database provider.

Enumerations

  Enumeration Description
Public enumeration ColumnChanges Defines the values for pending column changes.
Public enumeration ForeignKeyChanges Specifies the changes for foreign keys in a database.
Public enumeration IndexChanges Specifies the types of index changes for a database.
Public enumeration IndexType Specifies the index types for databases.