如何使用查看器在 UWP 中查看 Entity Framework 创建的数据库?

How can I view the database created by Entity Framework in UWP using a viewer?

我创建了一个通过 EntityFramework 创建数据库的应用程序。我创建了一个继承DbContext的class并进行了配置。我也实现了这个抽象方法。

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    optionsBuilder.UseSqlite("Filename=People.db");
}

如题中所说,如何查看People.db?我检查了目录,它不在那里,所以它看起来像是内置的东西。为了方便,我如何动态修改它的内容?

默认情况下,数据库文件 People.db 将在 local folder of your current app. If your app is running on the PC device you may find it on C:\Users\{username}\AppData\Local\Packages\{your app package family name}\LocalState. Local folder directory can be read/right, which is suit for your to modify and save contents. More details about file access permissions on UWP please reference this article 中创建。

您还可以设置 SQLiteStudio 以使用 GUI 来查看数据库数据。

更多详情请参考Getting Started with EF Core on Universal Windows Platform (UWP) with a New Database。此示例包含如何在 运行 时间创建数据库和插入数据。