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); }
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); }
private bool CreateReferenceDatabase() { if (ReferenceMDFFile.Exists() && ReferenceLDFFile.Exists()) { return(false); } var error = false; // create database + data try { var start = LocalTime.Now; CreateDatabaseFromScripts(); } catch { error = true; throw; } finally { // Detach it DataAccessor.Current.DetachDatabase(ReferenceDatabaseName); if (error) { ReferenceMDFFile.Delete(harshly: true); ReferenceLDFFile.Delete(harshly: true); } } return(true); }