✅ Dispose method to "dispose" file resource when using LogTo method
Hello guys, I'm trying to implement some simple logging in my DbContext. I want to write the logs in a file; when done, I need to dispose/close the file. I read that we can't use the
using
using
keyword because this would mean that our file stream will be closed and we won't be able to open it again (I thing, can someone please confirm please) and so we need to use the
Dispose
Dispose
method.
public override void Dispose() { base.Dispose(); _logStream.Dispose(); }
public override void Dispose() { base.Dispose(); _logStream.Dispose(); }
Here is what is written in the docs, but I have the warning CA1816. I didn't understand what exactly I need to do, I can just add this line: