bool CreateReferenceDatabase() { if (ReferenceMDFFile.Exists() && ReferenceLDFFile.Exists()) { return(false); } var error = false; // create database + data try { CreateDatabaseFromScripts(); } catch { error = true; throw; } finally { // Detach it MasterDatabaseAgent.DetachDatabase(ReferenceDatabaseName); if (error) { ReferenceMDFFile.Delete(); ReferenceLDFFile.Delete(); } } return(true); }
bool CreateReferenceDatabase() { if (ReferenceMDFFile.Exists() && ReferenceLDFFile.Exists()) { Debug.WriteLine("Temp database. Aborted creating a new reference database for the current SQL Scripts. The DB file already exists: " + ReferenceMDFFile.FullName); return(false); } var error = false; // create database + data try { CreateDatabaseFromScripts(); } catch { error = true; throw; } finally { // Detach it MasterDatabaseAgent.DetachDatabase(ReferenceDatabaseName); if (error) { ReferenceMDFFile.Delete(harshly: true); ReferenceLDFFile.Delete(harshly: true); } } return(true); }