protected override void DbDeleteDatabase(DbConnection connection, int?commandTimeout, StoreItemCollection storeItemCollection)
        {
            if (connection == null)
            {
                throw new ArgumentNullException("connection must not be null");
            }

            if (storeItemCollection == null)
            {
                throw new ArgumentNullException("storeItemCollection must not be null");
            }

            SampleConnection sampleConnection = connection as SampleConnection;

            if (sampleConnection == null)
            {
                throw new ArgumentException("connection must be a valid SampleConnection");
            }

            string databaseName       = GetDatabaseName(sampleConnection);
            string dropDatabaseScript = DdlBuilder.DropDatabaseScript(databaseName);

            // clear the connection pool in case someone is holding on to the database
            sampleConnection.ClearPool();

            UsingMasterConnection(sampleConnection, (conn) =>
            {
                CreateCommand(conn, dropDatabaseScript, commandTimeout).ExecuteNonQuery();
            });
        }
        protected override void DbCreateDatabase(DbConnection connection, int?commandTimeout, StoreItemCollection storeItemCollection)
        {
            if (connection == null)
            {
                throw new ArgumentNullException("connection must not be null");
            }

            if (storeItemCollection == null)
            {
                throw new ArgumentNullException("storeItemCollection must not be null");
            }

            SampleConnection sampleConnection = connection as SampleConnection;

            if (sampleConnection == null)
            {
                throw new ArgumentException("The connection is not of type 'SampleConnection'.");
            }

            string databaseName = GetDatabaseName(sampleConnection);

            if (string.IsNullOrEmpty(databaseName))
            {
                throw new InvalidOperationException("Initial Catalog is missing from the connection string");
            }

            string dataFileName, logFileName;

            GetDatabaseFileNames(sampleConnection, out dataFileName, out logFileName);

            string createDatabaseScript = DdlBuilder.CreateDatabaseScript(databaseName, dataFileName, logFileName);
            string createObjectsScript  = DdlBuilder.CreateObjectsScript(storeItemCollection);

            UsingMasterConnection(sampleConnection, conn =>
            {
                // create database
                CreateCommand(conn, createDatabaseScript, commandTimeout).ExecuteNonQuery();
            });

            // Clear connection pool for the database connection since after the 'create database' call, a previously
            // invalid connection may now be valid.
            sampleConnection.ClearPool();

            UsingConnection(sampleConnection, conn =>
            {
                // create database objects
                CreateCommand(conn, createObjectsScript, commandTimeout).ExecuteNonQuery();
            });
        }