I am working on a standalone C# Winforms app which interacts with a local SQL Server database. At a certain point, I migrated from Access to SQL Server LocalDB and created a SSDT project for versioning the database. I don't use EF at the moment in my project.
I have reached a stage where I need to deploy the app via an installer. I am using clickonce publish to generate it, but I am a bit confused on what is the best option for deploying the database.
These are all the solutions I have found so far:
Add SQL Server Express LocalDB Prerequisites and use SqlPackage to publish a
.dacpac
during installation and update. According to Microsoft (https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-ver16),localdb
is a feature meant to be used during development. Is there a reason for that beside having to installing SQL server on user's OS?Get rid of SSDT and use a service-based database
.mdf
file, then deploy it as an application file and useAttachDBFilename=<.mdf file>
in the connection string. This will require to install SQL Server Express LocalDB anyway so, what is the improvement over the previous solution? Does.mdf
support schema changes without data loss during updates?Move to EF and rely on migration to create a new database, then, connect to it using, for instance, Sqlite. Is it possible to have both SSDT (for the development environment) and EF?