Exemplo n.º 1
0
        private static void ExportToMysql()
        {
            var mysql = new GirlAgencyMySql.Data.MySql();
            //mysql.Database.ExecuteSqlCommand("TURNCATE TABLE['Girls']");
            var sqlGirlsRepo     = new GenericRepository <Girl>(new GirlsAgencyContext());
            var sqlCountriesRepo = new GenericRepository <Country>(new GirlsAgencyContext());
            var sqlCitiesRepo    = new GenericRepository <City>(new GirlsAgencyContext());
            var sqlClientsRepo   = new GenericRepository <Customer>(new GirlsAgencyContext());
            var sqlOrdersRepo    = new GenericRepository <Order>(new GirlsAgencyContext());

            var mySqlGirlsRepo     = new GenericRepository <Girl>(new GirlAgencyMySql.Data.MySql());
            var mySqlCountriesRepo = new GenericRepository <Country>(new GirlAgencyMySql.Data.MySql());
            var mySqlCitiesRepo    = new GenericRepository <City>(new GirlAgencyMySql.Data.MySql());
            var mySqlClientsRepo   = new GenericRepository <Customer>(new GirlAgencyMySql.Data.MySql());
            var mysSqlOrdersRepo   = new GenericRepository <Order>(new GirlAgencyMySql.Data.MySql());


            //sqlCountriesRepo.GetAll().
            //    ToList().ForEach(
            //    (n => mySqlCountriesRepo.Add(n)));
            //sqlCitiesRepo.GetAll().ForEachAsync(n => mySqlCitiesRepo.Add(n));
            //sqlGirlsRepo.GetAll().ForEachAsync(n => mySqlGirlsRepo.Add(n));
            //sqlClientsRepo.GetAll().ForEachAsync(n => mySqlClientsRepo.Add(n));
            //sqlOrdersRepo.GetAll().ForEachAsync(n => mysSqlOrdersRepo.Add(n));

            //  mySqlCitiesRepo.GetAll().ForEachAsync(n=> Console.WriteLine(n.Name));

            ExportCountriesFromMSSqlToMySql(sqlCountriesRepo, mySqlCountriesRepo);
            ExportGirlsFromMSSqlToMySql();
            ExportCitiesFromMSSqlToMySQL(sqlCitiesRepo, mySqlCitiesRepo);
            ExportCustomerFromMSSqlToMySQL();
            ExportOrdersFromMSSqlToMySql(sqlOrdersRepo, mysSqlOrdersRepo);


            //ExportGirlsFromMSSqlToMySql(sqlGirlsRepo, mySqlGirlsRepo);
        }
Exemplo n.º 2
0
        private static void ExportToMysql()
        {
            var mysql = new GirlAgencyMySql.Data.MySql();
            //mysql.Database.ExecuteSqlCommand("TURNCATE TABLE['Girls']");
            var sqlGirlsRepo = new GenericRepository<Girl>(new GirlsAgencyContext());
            var sqlCountriesRepo = new GenericRepository<Country>(new GirlsAgencyContext());
            var sqlCitiesRepo = new GenericRepository<City>(new GirlsAgencyContext());
            var sqlClientsRepo = new GenericRepository<Customer>(new GirlsAgencyContext());
            var sqlOrdersRepo = new GenericRepository<Order>(new GirlsAgencyContext());

            var mySqlGirlsRepo = new GenericRepository<Girl>(new GirlAgencyMySql.Data.MySql());
            var mySqlCountriesRepo = new GenericRepository<Country>(new GirlAgencyMySql.Data.MySql());
            var mySqlCitiesRepo = new GenericRepository<City>(new GirlAgencyMySql.Data.MySql());
            var mySqlClientsRepo = new GenericRepository<Customer>(new GirlAgencyMySql.Data.MySql());
            var mysSqlOrdersRepo = new GenericRepository<Order>(new GirlAgencyMySql.Data.MySql());

            //sqlCountriesRepo.GetAll().
            //    ToList().ForEach(
            //    (n => mySqlCountriesRepo.Add(n)));
            //sqlCitiesRepo.GetAll().ForEachAsync(n => mySqlCitiesRepo.Add(n));
            //sqlGirlsRepo.GetAll().ForEachAsync(n => mySqlGirlsRepo.Add(n));
            //sqlClientsRepo.GetAll().ForEachAsync(n => mySqlClientsRepo.Add(n));
            //sqlOrdersRepo.GetAll().ForEachAsync(n => mysSqlOrdersRepo.Add(n));

            //  mySqlCitiesRepo.GetAll().ForEachAsync(n=> Console.WriteLine(n.Name));

            ExportCountriesFromMSSqlToMySql(sqlCountriesRepo, mySqlCountriesRepo);
            ExportGirlsFromMSSqlToMySql();
            ExportCitiesFromMSSqlToMySQL(sqlCitiesRepo, mySqlCitiesRepo);
            ExportCustomerFromMSSqlToMySQL();
            ExportOrdersFromMSSqlToMySql(sqlOrdersRepo, mysSqlOrdersRepo);

            //ExportGirlsFromMSSqlToMySql(sqlGirlsRepo, mySqlGirlsRepo);
        }