[英]If I create a C# desktop application with SQLite, will the database get bundled with the installer?
I am trying to make an application for managing a small store, which will be offline.我正在尝试制作一个用于管理小型商店的应用程序,该商店将脱机。 I am considering using SQLite for my data handling needs.
我正在考虑使用 SQLite 来满足我的数据处理需求。 Once I create the installer for this project, does the database get attached to the installer or will have have to take additional steps to make the application work.
一旦我为这个项目创建了安装程序,数据库是否会附加到安装程序,或者必须采取额外的步骤来使应用程序工作。
Also is SQLite the best way to approach this or should I consider something else? SQLite 是解决这个问题的最佳方法还是我应该考虑其他方法?
Since SQLite needs a file to work with you can include a file which contains empty schema of your SQLite database in your setup project and copy it to working directory.由于 SQLite 需要一个文件才能使用,因此您可以在安装项目中包含一个包含 SQLite 数据库空架构的文件,并将其复制到工作目录。 Or add your empty db file as a resource to your application.
或者将您的空 db 文件作为资源添加到您的应用程序中。 And in your connection string builder/provider check existence of the file if it doesn't exists read it from resource and copy to the target location.
并在您的连接字符串构建器/提供程序中检查文件是否存在,如果它不存在,则从资源中读取它并复制到目标位置。 And also SQLite is good option for that kind of usage.
SQLite 也是这种用法的不错选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.