-
-
Save hagbarddenstore/a3e94bd6a4a44ddf2648 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void insertWords(List<string> words) | |
{ | |
var context = new OperationDataContext(); | |
var existingWords = context.GetTable<english_dictionary>().Where(word => words.Contains(word)).ToList(); | |
var wordsToInsert = words.Except(existingWords).ToList(); | |
foreach (var word in wordsToInsert) | |
{ | |
var dictionary = new english_dictionary { word = word.Trim() }; | |
context.english_dictionaries.InsertOnSubmit(dictionary); | |
} | |
context.SubmitChanges(); | |
Console.WriteLine("Database insert operations complete."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment