Пример #1
0
        public static void ImportJokeJson()
        {
            List <Joke> list = new List <Joke>();

            list.AddRange(ImportFile("stupidstuff.json", JokeSourceEnum.StupidstuffJson));
            list.AddRange(ImportFile("reddit_jokes.json", JokeSourceEnum.RedditJokesJson));
            list.AddRange(ImportFile("wocka.json", JokeSourceEnum.WockaJson));
            var enity = new EnglishWordsEntities();

            enity.BulkInsert <Joke>(list);
        }
Пример #2
0
        public static void ImportWords()
        {
            var wordText = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "\\Import_Word.txt");
            var words    = wordText.Split(new char[] { ',', '\"', ' ', '\r', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries);
            var lists    = words.Select(x => new AllWordFromPaymon {
                Word = x.Trim(),
            }).Where(x => !string.IsNullOrEmpty(x.Word)).ToList();

            Console.WriteLine("Intering..");
            var entity = new EnglishWordsEntities();

            entity.BulkInsert(lists);
            Console.WriteLine("Inserted");
        }