I'm working on a project related to databases in C#. After each transaction commit, I want the db to move all the buffered data onto disk. In Linux, fflush() + fsync() would provide what I want. To get the same effect, what should I do in C#?
The method corresponding to C' fflush() is Flush() of FileStream class.
Anyway, this is related to files, not to databases.
EDIT
If you are targeting 4.0 .NET Framework, there's a new overload that accepts a boolean. According to its description:
Flush(bool flushToDisk)
flushToDisk
Type: System.Boolean
true to flush all intermediate file buffers; otherwise, false.
you should invoke it passing true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With