如何获得UWP卸载以完全删除数据库? [英] How do I get UWP Uninstall to remove database completely?

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

问题描述

我设法通过Desktop Bridge将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?

在Desktop Bridge本身中看不到任何可执行代码.

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)

推荐答案

请参见

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卸载以完全删除数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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