views:

78

answers:

2

Hello. I am creating a service, that needs to perform the following tasks: consult bank services and persist data into DB. The dificult is: Its needed to execute each process in parallel.

I mean the better choice is implementing a multithreading service, running each instance per thread. But how its done?

Thanks

+1  A: 

You can use a ThreadPool to do this.

How to: Use a Thread Pool (C# Programming Guide) would be a good place to start reading about thread pools.

Justin Ethier
+1  A: 

If you can target .Net Framework 3.0+ you should consider using a workflow (WF). WF allows you to synchronize granular operations into a global activity. Beware that the ParallelActivity is not multithreaded activity execution. You will find tons of samples on the net about WF for the kind of app you are working on.

Basbrun