I am trying to write a WCF service that will be in a windows service. This WCF service will simply add rows to the list, and then the workflow will process this list periodically. What is the best way to achieve this? I read conflicting examples that left me confused. What is the best way to use the service and stream for a list object?
Update: Thanks for the answers. To clarify, I am not trying to synchronize the list or how to make it thread safe. All this is similar to the same principles as in C ++. What I'm struggling with is defining this list so that it is accessible from both the WCF service and the workflow. In C ++, I would create a list in the global scope, but C # does not have a global scope. If I define it in the WCF service class, the stream will not be able to see it. If I define this in the service class (where the thread function is defined and started), the WCF service will not be able to see it. I'm sure some time ago I did something similar in ATL, but on Friday afternoon, and the gray cells refused during the day.
Update2: Where should I define the workflow? In the Windows service class (i.e. in the host) or in the WCF service? Should a WCF service be a single-user service that has a list item and stream function? This solves the access problem. Having done a lot of COM, I think of the WCF service as a COM component when an instance dies after it is accessed. This prompted me to enable the static list and stream function in the Windows service class. This still seems like a more natural place for it, but maybe I just don't think about the .NET way.
source share