I am using Entity Framework with SQlite. I have a dll file including a class (named UserStorage) which have a implementer of dbcontext in it. And this instance of dbcontext is private. So I can not have access to its dbcontext. Now I want to use this and immediately after that, I want to delete the .sqlite (db) file.
UserStorage does not have any method for this. So I just can make the instance null like this:
string fileAdress = ...
UserStorage storage = new UserStorage(fileAdress);
//Some operation on storage
storage = null;
System.IO.File.Delete(fileAdress);
But It gives me this exception:
System.IO.IOException: The process cannot access the file 'The adress of the file' because it is being used by another process...
I tested, there is no other app using this file. So What is the problem?
Aucun commentaire:
Enregistrer un commentaire