使用Visual Studio实体框架和C#序列化/反序列化sqlite数据库

时间:2022-06-14 09:51:47

I'm using the SQLite.net provider and VS Entity Designer to design and code against a sqlite database. At present, a model sqlite database is checked in to the source tree.

我正在使用SQLite.net提供程序和VS实体设计器来设计和编写sqlite数据库代码。目前,模型sqlite数据库已签入源树。

However, this is binary which is inconvenient for use with a revision control system.

然而,这是二进制的,这对于与修订控制系统一起使用是不方便的。

I'd like to check in a serialized version using sqlite's .dump, but am not sure what the steps would be to achieve the following:

我想使用sqlite的.dump检查序列化版本,但不确定实现以下步骤是什么:

  1. A serialized form of the model database is checked in to the tree.
  2. 将序列化形式的模型数据库签入树中。

  3. When the solution is opened or updated from the source control system, the SQLite database used by the designer is automatically updated.
  4. 从源代码管理系统打开或更新解决方案时,设计器使用的SQLite数据库会自动更新。

  5. Changes to the database from the database designer update the serialized version.
  6. 从数据库设计器更改数据库更新序列化版本。

Are there a set of custom build steps that would make this relatively seamless? Thanks,

是否有一组自定义构建步骤可以使其相对无缝?谢谢,

2 个解决方案

#1


Where I'm at, I want to be able to just check out a project from subversion and compile it without modification. That means having the sqlite db available as a binary.

在我所在的位置,我希望能够从subversion中检出项目并进行编译而无需修改。这意味着将sqlite db作为二进制文件提供。

I understand the desire to be able to diff against, but you can get almost as good functionality by making good check-in comments. Unless the conversion happens at the level of your source control client, having to maintain the .dump will just add friction to your development process, and that's probably the larger concern.

我理解能够反对的愿望,但你可以通过制作好的签到评论来获得几乎同样好的功能。除非转换发生在源代码控制客户端的级别,否则必须维护.dump只会给开发过程增加摩擦,这可能是更大的问题。

#2


I find it a good practice, if a little cumbersome, to put SQL DDL scripts under source control when database versioning is necessary. If you have a test dataset, you can import it at the beginning of your build and test runs.

我觉得如果有点麻烦的话,在需要数据库版本控制时将SQL DDL脚本置于源代码控制之下是一个很好的做法。如果您有测试数据集,则可以在构建和测试运行开始时导入它。

#1


Where I'm at, I want to be able to just check out a project from subversion and compile it without modification. That means having the sqlite db available as a binary.

在我所在的位置,我希望能够从subversion中检出项目并进行编译而无需修改。这意味着将sqlite db作为二进制文件提供。

I understand the desire to be able to diff against, but you can get almost as good functionality by making good check-in comments. Unless the conversion happens at the level of your source control client, having to maintain the .dump will just add friction to your development process, and that's probably the larger concern.

我理解能够反对的愿望,但你可以通过制作好的签到评论来获得几乎同样好的功能。除非转换发生在源代码控制客户端的级别,否则必须维护.dump只会给开发过程增加摩擦,这可能是更大的问题。

#2


I find it a good practice, if a little cumbersome, to put SQL DDL scripts under source control when database versioning is necessary. If you have a test dataset, you can import it at the beginning of your build and test runs.

我觉得如果有点麻烦的话,在需要数据库版本控制时将SQL DDL脚本置于源代码控制之下是一个很好的做法。如果您有测试数据集,则可以在构建和测试运行开始时导入它。