Exemple #1
0
        static void Main(string[] args)
        {
            var text = GetTextFromWord(@"D:\Repositories\BlessSongs.doc");

            //var text = File.ReadAllText(@"D:\Repositories\songsTx.txt");
            File.WriteAllText(@"D:\Repositories\songsTx.txt", text);
            var songTexts = PreprocessingToParsing(text);
            var songs     = songTexts.Select(s => new Song()
            {
                Text = string.Concat(s.SkipWhile(p => p != '\n'))
            }).ToList();

            RemoveUnnecessarySymbolsAndSetNameAndId(songs);
            var db = new SongsContext();

            SaveToDatabase(db, songs);
        }
Exemple #2
0
 private static void SaveToDatabase(SongsContext db, List <Song> songs)
 {
     db.Songs.RemoveRange(db.Songs);
     db.Songs.AddRange(songs);
     db.SaveChanges();
 }