public static void RegisterUnloadHandler (string connectionString, DerbyShutDownPolicy policy) { if (policy == DerbyShutDownPolicy.Never) return; if (connectionString.IndexOf("org.apache.derby.jdbc.EmbeddedDriver", StringComparison.Ordinal) < 0) return; DerbyUnloadManager derbyMan = new DerbyUnloadManager (connectionString, policy); AppDomain.CurrentDomain.DomainUnload += new EventHandler (derbyMan.UnloadHandler); }
DbConnection CreateConnection() { if (!schemaChecked) { DerbyDBSchema.CheckSchema(connectionString.ConnectionString); schemaChecked = true; DerbyUnloadManager.RegisterUnloadHandler(connectionString.ConnectionString, shutDownPolicy); } OleDbConnection connection = new OleDbConnection(connectionString.ConnectionString); connection.Open(); return(connection); }