In Entity Framework 7 I store words from dictionaries having a structure like this:
[Table("Dictionaries")]
public class Dictionary
{
public int DictionaryId { get; set; }
public string Name { get; set; }
public virtual List<Word> Words { get; set; }
}
[Table("Words")]
public class Word
{
public int WordId { get; set; }
public string Text { get; set; }
public int DictionaryId { get; set; }
public Dictionary Dictionary { get; set; }
}
It creates an SQLite database.
I create a new Dictionary like this:
var dictionary = new Dictionary {
Name = jsonDictionary.Name,
Words = GetWords()
};
There are about 90,000 words. I'd like to store it fast. I tried with:
db.ChangeTracker.AutoDetectChangesEnabled = false;
db.ChangeTracker.QueryTrackingBehavior = Microsoft.Data.Entity.QueryTrackingBehavior.NoTracking;
db.Dictionaries.Add(dictionary);
But it takes like half an hour in a fast computer. I tried several convinations, like storing words in chunks of 100, 1000, etc. But all the tests are really slow.
Is it there any way to store huge quantities of date in SQLite in a fast way?
Aucun commentaire:
Enregistrer un commentaire