DependenciesMissingException Class

Inheritance Hierarchy

System.Object
  System.Exception
    Microsoft.Web.Management.DatabaseManager.DependenciesMissingException

Namespace:  Microsoft.Web.Management.DatabaseManager
Assembly:  Microsoft.Web.Management.DatabaseManager (in Microsoft.Web.Management.DatabaseManager.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class DependenciesMissingException _
    Inherits Exception
'Usage
Dim instance As DependenciesMissingException
[SerializableAttribute]
public class DependenciesMissingException : Exception
[SerializableAttribute]
public ref class DependenciesMissingException : public Exception
public class DependenciesMissingException extends Exception

The DependenciesMissingException type exposes the following members.

Constructors

  Name Description
Public method DependenciesMissingException() Creates a new instance of the DependenciesMissingException class.
Public method DependenciesMissingException(String)
Protected method DependenciesMissingException(SerializationInfo, StreamingContext) Creates a new instance of the DependenciesMissingException class.
Public method DependenciesMissingException(String, Exception) Creates a new instance of the DependenciesMissingException class.

Top

Properties

  Name Description
Public property Data (Inherited from Exception.)
Public property HelpLink (Inherited from Exception.)
Protected property HResult (Inherited from Exception.)
Public property InnerException (Inherited from Exception.)
Public property Message (Inherited from Exception.)
Public property Source (Inherited from Exception.)
Public property StackTrace (Inherited from Exception.)
Public property TargetSite (Inherited from Exception.)

Top

Methods

  Name Description
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetBaseException (Inherited from Exception.)
Public method GetHashCode (Inherited from Object.)
Public method GetObjectData (Inherited from Exception.)
Public method GetType (Inherited from Exception.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ToString (Inherited from Exception.)

Top

Remarks

You can implement the VerifyDependencies method to verify any dependencies that your database provider may have. This method takes no parameters and does not have a return value; your database provider should raise an exception using the DependenciesMissingException class if the operating system environment does not meet your database provider's dependencies.

Examples

The following code sample illustrates an example VerifyDependencies method that verifies the dependencies for a sample OLEDB provider.


    ' Verify the database provider dependencies.
    Public Overrides Sub VerifyDependencies()

        Try
            ' Create a database provider factory for OLEDB.
            Dim oledbFactory As DbProviderFactory = _
                DbProviderFactories.GetFactory("System.Data.OleDb")
            ' Test for null.
            If (Not (oledbFactory) Is Nothing) Then
                ' Create an assembly name class.
                Dim name As AssemblyName = _
                    New AssemblyName(oledbFactory.GetType.Assembly.FullName)
                ' Test the version to make sure that it's greater than 1.
                If (name.Version.Major < 1) Then
                    ' Raise an exception if the version is not sufficient.
                    Throw New DependenciesMissingException("https://www.iis.net/")
                End If
            End If
        Catch
            ' Throw an exception when an error occurs.
            Throw New DependenciesMissingException("https://www.iis.net/")
        End Try

    End Sub


        // Verify the database provider dependencies.
        public override void VerifyDependencies()
        {
            try
            {
                // Create a database provider factory for OLEDB.
                DbProviderFactory oledbFactory = DbProviderFactories.GetFactory("System.Data.OleDb");
                // Test for null.
                if (oledbFactory != null)
                {
                    // Create an assembly name class.
                    AssemblyName name = new AssemblyName(oledbFactory.GetType().Assembly.FullName);
                    // Test the version to make sure that it's greater than 1.
                    if (name.Version.Major < 1)
                    {
                        // Raise an exception if the version is not sufficient.
                        throw new DependenciesMissingException("https://www.iis.net/");
                    }
                }
            }
            catch
            {
                // Throw an exception when an error occurs.
                throw new DependenciesMissingException("https://www.iis.net/");
            }
        }

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Web.Management.DatabaseManager Namespace