开发者

C# WinForm Concurrency with Invoke

开发者 https://www.devze.com 2023-03-02 04:47 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消