public override void DeleteList() { using var dbContext = new SQLiteDbContext(DbFilename); var blogPostsToDelete = dbContext.BlogPosts.ToList(); dbContext.BlogPosts.RemoveRange(blogPostsToDelete); dbContext.SaveChanges(); }
public override void ReadList() { using var dbContext = new SQLiteDbContext(DbFilename); foreach (var blogPost in dbContext.BlogPosts) { ReadBlogPosts.Add(blogPost); } }
public override void CreateList() { using var dbContext = new SQLiteDbContext(DbFilename); dbContext.BlogPosts.AddRange(BlogPosts.List); dbContext.SaveChanges(); }
public override void Prepare() { using var dbContext = new SQLiteDbContext(DbFilename); dbContext.Database.EnsureCreated(); }