如何让 UWP Uninstall 完全删除数据库? [英] How do I get UWP Uninstall to remove database completely?

查看:18
本文介绍了如何让 UWP Uninstall 完全删除数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已设法通过桌面桥将 XAF 应用程序导入 Windows 应用商店.

I have managed to get an XAF application into the Windows Store via the Desktop Bridge.

当用户从 Windows 应用商店安装我的软件然后选择卸载时,我希望他们可以选择完全卸载包括数据库在内的软件.这样他们以后决定重新安装时不会有任何问题吗?

When a user installs my software from the Windows Store and then chooses to uninstall, I want them to have the option to completely uninstall the software including the database. So that they won't have any problem should they later decide to re-install?

目前,UWP 卸载没有提供删除数据库的选项(甚至解释如何删除它)因此用户可能会想通过 Windows 资源管理器删除数据文件 - 这仍然会留下一些 LocalDB 实例维护一个数据库列表中的条目.

Currently, the UWP uninstall does not give an option to delete the database ( or even explain how to delete it ) Thus the user may be tempted to delete the data files via Windows Explorer - which still leaves some instance of LocalDB maintaining an entry in its list of databases.

因此在删除数据库文件后第二次安装时,UWP 程序会显示错误

Thus on a second install after deleting the database files, the UWP program displays the error

"Login failed for user" 

如解释 在这个问题中

我的连接字符串正在使用

My connection string is using

(localdb)mssqllocaldb

如何自动完全删除数据库和内存?

How do I automate removing the database and memory of it completely?

即我可以使用什么卸载事件,我在哪里覆盖什么?

i.e What uninstall event can I use, What do I override where?

我在桌面桥本身中看不到任何可执行代码.

I can't see any executable code in the Desktop Bridge itself.

目前我认为我可能需要在实际程序中添加卸载前运行"选项.

At the moment I think I may need to put "Run This Before You Uninstall" option in the actual program.

或者作为一种解决方法,我应该为用户登录失败"错误编写一个清理处理程序.

Or perhaps as a workaround, I should code a Clean Up handler for the "Login failed for user" error.

这个问题是相关的

我正在使用 Entity Framework 6.2 和 .Net Framework 4.7.2

I am using Entity Framework 6.2 and .Net Framework 4.7.2

Bridge 项目使用的是 Windows 10 版本 1809,内部版本 17763(最小和目标)

The Bridge Project is using Windows 10, version 1809, Build 17763 ( Min and Target)

推荐答案

参见 在具有新数据库的通用 Windows 平台 (UWP) 上开始使用 EF Core.它介绍了迁移的使用.迁移旨在帮助您更改数据库设计并在生产中实施更改.但是,迁移可能会令人沮丧,因为 Microsoft 尚未彻底记录该功能.SQLite 不支持迁移功能的列表;从一开始就知道这一点很重要.

See Getting Started with EF Core on Universal Windows Platform (UWP) with a New Database. It introduces use of migrations. Migrations are designed to help you change your database design and implement the changes in production. Migrations can be frustrating though because Microsoft has not documented the feature thoroughly. There is a list somewhere of the migration features not supported for SQLite; it is important to know about that from the beginning.

这篇关于如何让 UWP Uninstall 完全删除数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆