开发者

Design Qn RE: System-wide timer (C#). What timer in what layer?

Thanks for taking time to read this question.

I am designing a 3-tier solution written in c# that needs to carry out processing every minute. The processing should be initiated at the same time from different unconnected parts of the program.

What's the best way 开发者_如何学JAVAto implement a system-wide timer? Should it be in the business logic layer or UI layer? What kind of timer is best, e.g. one from System.Forms of from System.Threading, or? Is there a rule of thumb for this situation?

Many thanks


I would say have a static or singleton class in your business layer expose an event, that can be subscribed to by everyone else in the application.

I would use System.Threading.Timer, which uses its own thread. System.Windows.Forms, conversely, is meant to be used inside a control (and I think runs in the UI thread).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜