Partilhar via


SPDatabase Members

Include Protected Members
Include Inherited Members

Encapsulates access to Microsoft SQL Server databases.

The SPDatabase type exposes the following members.

Constructors

  Name Description
Public method SPDatabase() Initializes a new instance of the SPDatabase class.
Public method SPDatabase(SPDatabaseParameters) Initializes a new instance of the SPDatabase class based on the specified SPDatabaseParameters object.
Public method SPDatabase(String, SPDatabaseServiceInstance) Initializes a new instance of the SPDatabase class based on the specified name and instance.

Top

Properties

  Name Description
Protected property BuildVersion Gets the cached build version of the database.
Public property CanRenameOnRestore Gets a Boolean value that indicates whether the database can be renamed when it is restored.
Public property CanSelectForBackup Gets or sets a Boolean value that specifies whether the database object and its children can be selected for a backup operation in the Central Administration user interface.
Public property CanSelectForRestore Gets or sets a Boolean value that specifies whether this object and its children can be selected for a restore operation in the Central Administration user interface.
Public property CanUpgrade Gets a value that indicates whether the object can be upgraded. (Inherited from SPPersistedUpgradableObject.)
Public property DatabaseConnectionString Gets the connection string that is used to connect to the database.
Public property DiskSizeRequired Gets the amount of disk space that is required for a backup.
Public property DisplayName Gets the display name that describes the persisted object instance within the administrative user interface. (Inherited from SPPersistedObject.)
Public property Exists Gets a Boolean value that indicates whether the database exists.
Public property FailoverServer Gets the SPServer object that represents the server that is hosting the mirror of the database.
Public property FailoverServiceInstance Gets or sets the SPDatabaseServiceInstance object that represents the instance of the database service that is hosting the mirror of the database.
Public property Farm Gets the server farm where the object resides. (Inherited from SPPersistedObject.)
Public property Id Gets or sets the GUID that is associated with the object. (Inherited from SPPersistedObject.)
Public property IncludeInVssBackup Gets a Boolean value that indicates whether the database is included in the Microsoft Visual SourceSafe component list.
Public property IsBackwardsCompatible Gets or sets a value that indicates whether the current object is backward compatible. (Inherited from SPPersistedUpgradableObject.)
Public property IsReadOnly Gets a value that indicates whether the database is read-only.
Public property LegacyDatabaseConnectionString Gets a string that contains the OLEDB connection string.
Public property Name Gets or sets a name that is used to uniquely identify two objects that have the same parent and class. (Inherited from SPPersistedObject.)
Public property NeedsUpgrade Gets or sets a Boolean value that specifies whether the object needs to be upgraded. (Inherited from SPPersistedUpgradableObject.)
Public property NeedsUpgradeIncludeChildren Gets a Boolean value that indicates whether the object should be upgraded, considering the children of the object. (Inherited from SPPersistedUpgradableObject.)
Public property NormalizedDataSource Gets the normalized data source of the database.
Public property Parent Gets the parent in the logical hierarchy of the configuration object tree. (Inherited from SPPersistedObject.)
Public property Password Gets or sets the password that is used for SQL authentication.
Public property Properties Gets metadata for the persisted object. (Inherited from SPPersistedObject.)
Public property SchemaVersionXml Gets information about the schema versions associated with this [c] derived class.
Public property Server Gets the server that contains the database.
Public property ServiceInstance Gets an instance of the SQL service that owns the database.
Public property Snapshots Gets the snapshots of the database.
Public property Status Gets or sets the status of the object that the class represents. (Inherited from SPPersistedObject.)
Public property TypeName Gets the display name that describes the object type in the administrative user interface. (Inherited from SPPersistedObject.)
Public property UpgradeContext Gets the SPUpgradeContext for the current upgrade operation. (Inherited from SPPersistedUpgradableObject.)
Public property UpgradedPersistedProperties Gets the collection of field names and values for fields that were deleted or changed. (Inherited from SPAutoSerializingObject.)
Public property Username Gets or sets the user name that is used for SQL authentication login.
Public property Version Gets a value that is incremented each time the object is updated. (Inherited from SPPersistedObject.)
Protected property WasCreated Gets a Boolean value that indicates whether the object is initialized and can be found in the database. (Inherited from SPPersistedObject.)

Top

Methods

  Name Description
Public method AddBackupObjects Adds the database and its children to the backup/restore job.
Public method AddFailoverServiceInstance Identifies to SharePoint Foundation a server and a database service instance that hosts the mirror of the database.
Public method ChangeDatabaseInstance(String) Modifies the database service instance with the specified name for each connection string that is used to access the database.
Public method ChangeDatabaseInstance(SPDatabaseServiceInstance) Modifies the specified database service instance for each connection string that is used to access the database.
Public method Clone Returns a clone of the object that does not come from the in-memory cache, which enables calling code to help ensure thread safety. (Inherited from SPPersistedObject.)
Public method Delete Deletes the object. (Inherited from SPPersistedObject.)
Public method Equals Determines whether the current persisted object equals the specified object. (Inherited from SPPersistedObject.)
Protected method Finalize (Inherited from Object.)
Public methodStatic member GenerateConnectionStringForProvisioning Creates a connection string that is used in provisioning based on a specified connection string.
Public methodStatic member GenerateRandomName Generates a random database name using the specified connection string as a starting point.
Public method GetChild<T>() Returns the child of the persisted object based on the specified type. (Inherited from SPPersistedObject.)
Public method GetChild<T>(String) Returns the child object of the persisted object based on the specified name. (Inherited from SPPersistedObject.)
Public method GetHashCode Serves as a hash function for the persisted object. (Inherited from SPPersistedObject.)
Public method GetObjectData Gets the serialized state of the object. (Inherited from SPAutoSerializingObject.)
Public method GetType (Inherited from Object.)
Protected method GetVersionForId Returns the schema version associated with the upgrade sequence specified by ID.
Protected method GrantAccess(SecurityIdentifier) Grants the specified user access to the database.
Protected method GrantAccess(SecurityIdentifier, String) Grants the specified user access to the database and adds the user to the specified role.
Public method GrantOwnerAccessToDatabaseAccount Grants the database owner permissions to the database access account.
Protected method HasAdditionalUpdateAccess Override this method to allow more users to update the object. (Inherited from SPPersistedObject.)
Public method Invalidate Invalidates the cached version stamp and other flags that are related to upgrade. (Overrides SPPersistedUpgradableObject.Invalidate().)
Public method IsEmpty Determines if the database is empty.
Protected method MemberwiseClone (Inherited from Object.)
Public method OnAbort Raises the Abort (backup) event.
Public method OnBackup Raises the Backup event.
Public method OnBackupComplete Raises the BackupComplete event.
Protected method OnDeserialization Called immediately after the base class deserializes itself to do additional work. (Inherited from SPPersistedObject.)
Public method OnPostRestore Raises the PostRestore event.
Public method OnPrepareBackup Raises the PrepareBackup event.
Public method OnPreRestore Raises the PreRestore event.
Public method OnRestore Raises the Restore event.
Public method Provision() Makes the changes to the local server that are needed before the object can be used. (Inherited from SPPersistedObject.)
Protected methodStatic member Provision(SqlConnectionStringBuilder, TextReader, Dictionary<String, Boolean>) Creates a Microsoft SQL Server database with a user schema, creating the schema if it is necessary
Protected methodStatic member Provision(SqlConnectionStringBuilder, String, Dictionary<String, Boolean>) Prepares a Microsoft SQL Server database for use with Microsoft SharePoint Foundation. If the database does not exist it will be created. If the database exists prior to calling the method, it will be provisioned with the SharePoint schema.
Protected methodStatic member Provision(String, String, Dictionary<String, Boolean>) Creates a Microsoft SQL Server database with a user schema, creating the schema if necessary.
Public method ToString Returns the type and name of an object and of all its ancestors (parent, grandparent, and so on). (Inherited from SPPersistedObject.)
Public method Uncache Frees the memory cache that is used by the object. (Inherited from SPPersistedObject.)
Public method Unprovision Makes the necessary changes to the local server to clean up after deleting the database. (Overrides SPPersistedObject.Unprovision().)
Public method Update() Causes the database to save its state and propagate changes to all the computers in the server farm. (Overrides SPPersistedObject.Update().)
Public method Update(Boolean) Causes the object to save its state and propagate changes to all the computers in the server farm, optionally throwing an exception if the object already exists in the configuration store. (Inherited from SPPersistedObject.)
Protected method UpdateParent Causes the containing SPPersistedObject, if one exists, to update its state. (Inherited from SPAutoSerializingObject.)
Public method Upgrade() Upgrades the object. (Inherited from SPPersistedUpgradableObject.)
Public method Upgrade(Boolean) Upgrades the object, and if a Boolean parameter equals true, recursively upgrades all descendants of the current object. (Inherited from SPPersistedUpgradableObject.)
Protected method Validate Validates the state of all fields before persisting the object. (Inherited from SPPersistedObject.)
Public method ValidateBackwardsCompatibility Validates the backward compatibility of the content database schema for the DLLs on the Web front end. This method is called each time a connection is made to the content database to verify that the database schema is compatible. (Inherited from SPPersistedUpgradableObject.)
Protected method WarnAboutRemoteBlobStorageSettings Returns a Boolean value that specifies whether the administrator is warned that external binary large object (BLOB) storage is installed.

Top

Fields

  Name Description
Protected fieldStatic member SqlDatabaseOption Specifies SQL database options that are used in Transact-SQL statements.

Top

See Also

Reference

SPDatabase Class

Microsoft.SharePoint.Administration Namespace