Exemple #1
0
        //[TestMethod]
        public void A_ConvertOldToNewData()
        {
            var database = new TVTDatabase();

            database.Initialize();

            using (var connection = TVTSQLSession.GetSession())
            {
                var movies = TVTCommandsV2.LoadMoviesOldV2(connection);

                OldV2Converter.Convert(movies, database, TVTDataRoot.V2InStorage);

                TVTCommandsV2.LoadFakesForPeople(connection, database.GetAllPeople());

                OldV2Converter.RefreshMovieDescriptions(database);
                OldV2Converter.FakePersonNames(database);

                var ads = TVTCommandsV2.LoadAdsOldV2(connection);
                OldV2Converter.Convert(ads, database, TVTDataRoot.V2InStorage);

                var news = TVTCommandsV2.LoadNewsOldV2(connection);
                var tt   = news.FirstOrDefault(x => x.title.StartsWith("Programmierer"));
                OldV2Converter.Convert(news, database, TVTDataRoot.V2InStorage);

                database.RefreshPersonProgrammeCount();
                database.RefreshReferences();
                database.RefreshStatus();
            }

            using (var connection = TVTSQLSession.GetSessionNewDB())
            {
                TVTCommandsV3.Insert <TVTPerson>(connection, TVTCommandsV3.GetPersonSQLDefinition(), database.GetAllPeople());
                TVTCommandsV3.Insert <TVTProgramme>(connection, TVTCommandsV3.GetProgrammeSQLDefinition(), database.GetAllProgrammes(true, true));
                //TVTCommandsV3.Insert<TVTEpisode>( connection, TVTCommandsV3.GetEpisodeSQLDefinition(), database.GetAllEpisodes() );
                TVTCommandsV3.Insert <TVTAdvertising>(connection, TVTCommandsV3.GetAdvertisingSQLDefinition(), database.GetAllAdvertisings());
                TVTCommandsV3.Insert <TVTNews>(connection, TVTCommandsV3.GetNewsSQLDefinition(), database.GetAllNews());
            }
        }