Release and/or Delete SQLite database
See original GitHub issueSteps to reproduce
I have a sqlite database that I create locally. Whenever the app goes online and a user signs in an identical in structure, already populated sqlite database is retrieved from a server. I also have an “offline” database that stores local changes that eventually get synced to the cloud. My app uses the offline database as the main database and attaches the online database. The problem I am having is when I try to retrieve this online database and overwrite the existing online database. I have tried closing the connection, detaching the database and calling EnsureDeleted
but every time I try to save the file data to the existing database file, I am notified that the file is already being used by another process. Which makes sense, because the SQLite file is being used.
The issue
I need a way to release the file from the process either by detaching the database and/or closing the connection or deleting the existing file. Database.CloseConnection()
, Database.EnsureDeleted()
does not appear to work. When I call Database.EnsureDeleted()
, I also get the error so the attempts to detach and close the connection beforehand also did not work.
Further technical details
EF Core version: 1.0.1 Operating system: Windows 10 Visual Studio version: VS2015
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:15 (5 by maintainers)
Thanks for the app to reproduce it. We’ll get someone assigned to debug it. We’ve had a bit of a wave of issues come in, so it may take a little bit to get to it.
Sure I’ll put something together