Exemple #1
0
        //private static string GetDatabaseFile(Repository repository)
        //{
        //    var dataPath = new DataPath(repository.Name);
        //    var dataFile = Path.Combine(dataPath.PhysicalPath, repository.Name + ".mdf");
        //    return dataFile;
        //}

        //private static string GetIndividualDatabaseConnectionString(string connectionString, Repository repository)
        //{
        //    var connectionStringBuilder = new SqlConnectionStringBuilder(connectionString);

        //    connectionStringBuilder.InitialCatalog = repository.Name;

        //    return connectionStringBuilder.ConnectionString;
        //}
        //private static void CreateDatabase(Repository repository, string connectionString)
        //{
        //    var dataFile = GetDatabaseFile(repository);
        //    var dir = Path.GetDirectoryName(dataFile);
        //    IO.IOUtility.EnsureDirectoryExists(dir);
        //    //do not specify the file path.
        //    string sql = string.Format(@"CREATE DATABASE [{0}]"
        //        , repository.Name
        //        , Path.GetFileName(dataFile));
        //    SqlCommand command = new SqlCommand() { CommandText = sql };
        //    SQLServerHelper.ExecuteNonQuery(connectionString, command);
        //}
        //        private static void DropDatabase(Repository repository, string connectionString)
        //        {
        //            string sql = string.Format(@"IF EXISTS(SELECT * FROM sys.databases WHERE name = '{0}')
        //                                                DROP DATABASE {0}", repository.Name);

        //            SqlCommand command = new SqlCommand() { CommandText = sql };
        //            SQLServerHelper.ExecuteNonQuery(connectionString, command);
        //        }

        public static void DisposeDatabase(Repository repository)
        {
            SchemaManager.DropTable(repository, repository.GetCategoryTableName());
        }
Exemple #2
0
 public override void Remove(Models.Schema item)
 {
     base.Remove(item);
     SchemaManager.Delete(item);
 }
Exemple #3
0
 public override void Initialize(Models.Schema schema)
 {
     SchemaManager.Add(schema);
 }
Exemple #4
0
 public override void Update(Models.Schema @new, Models.Schema old)
 {
     base.Update(@new, old);
     SchemaManager.Update(@new, old);
 }