How do I get UWP Uninstall to remove database completely?

desktop-bridge entity-framework-6 windows-store xaf

Question

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

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?

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.

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

"Login failed for user" 

As explained in this question

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.

This issue is related

I am using Entity Framework 6.2 and .Net Framework 4.7.2

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

1
5
12/25/2018 6:07:36 AM

Popular Answer

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.

0
12/24/2018 8:01:04 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow