This topic has not yet been rated - Rate this topic

DatabaseProvider.VerifyDependencies Method

IIS 7.0

Verifies the database dependencies for your provider.

Namespace:  Microsoft.Web.Management.DatabaseManager
Assembly:  Microsoft.Web.Management.DatabaseManager (in Microsoft.Web.Management.DatabaseManager.dll)
public virtual void VerifyDependencies()

You can optionally 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 by using the DependenciesMissingException class if the operating system environment does not meet your database provider's dependencies.

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



        // 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("http://www.iis.net/");
                    }
                }
            }
            catch
            {
                // Throw an exception when an error occurs.
                throw new DependenciesMissingException("http://www.iis.net/");
            }
        }



Did you find this helpful?
(1500 characters remaining)