DbConnection CreateConnection ()
{
if (!schemaIsOk && !(schemaIsOk = AspNetDBSchemaChecker.CheckMembershipSchemaVersion (factory, connectionString.ConnectionString, "membership", "1")))
throw new ProviderException ("Incorrect ASP.NET DB Schema Version.");
DbConnection connection;
if (connectionString == null)
throw new ProviderException ("Connection string for the SQL Membership Provider has not been provided.");
try {
connection = factory.CreateConnection ();
connection.ConnectionString = connectionString.ConnectionString;
connection.Open ();
} catch (Exception ex) {
throw new ProviderException ("Unable to open SQL connection for the SQL Membership Provider.",
ex);
}
return connection;
}