views:

131

answers:

1

I have to implement a dll in C# which contains a list of tasks. The responsibility of this dll is to manage these tasks. Different processes will interact with this dll, each for its own task, identified by the task ID.

But since each process will have its own copy of the dll data, the challange is how to manage this list. This list has to be shared by all instances. I googled for sharing dll data and came across this-

data_seg approach seems useful only for static data with no scope for dynamically adding/deleting tasks in the list. (Correct me if I am wrong).

Should I go for memory mapped files? What if I just use basic file I/O? I am thinking of serializing this list of tasks into a file. Each process can then open it with FileShare.None set. That way the file access will be mutually exclusive and a process will wait if the file is already opened.

Please let me know which is the better approach or any other better alternatives.

Thanks

+1  A: 

Have you thought about hosting the dll in a WCF service? You could then have your apps make client calls to this service. The data could persist in the hosting wcf process.

Matt Wrock