C# WinForm Concurrency with Invoke
I have a UI that 开发者_运维知识库occasionally interacts with a MSSQL DB. There is a heartbeat thread that inserts/updates data to the same DB within an Invoke statement.
1) Is my implementation a safeguard against DB data inconsistency/corruption?
2) Is Invoke the most efficient/simplest way of creating DB serialization between UI thread/heartbeat thread or are locks the way to go?
You should think about BackgroundWorker. It is good abstraction of calling Invoke method, It handle most of cases.
精彩评论