Link to home
Start Free TrialLog in
Avatar of festijazz
festijazz

asked on

Best way to make a single object instance public to other processes ?

Hello Everyone,

I would like to ask you what is the best way to make a single object instance public to other processes ?  
As COM server exe is not directly foreseen is WCF still the right candidate ?

What do you think ?
Thank you very much in advance
Best regards.
MiQi.
Avatar of Prakash Samariya
Prakash Samariya
Flag of India image

You might looking for Singleton Pattern which allow only one instance!
Please check below link
Implementing the Singleton Pattern in C#
Avatar of festijazz
festijazz

ASKER

Hello Sir,
Thank you for your reply but I do not see how I will be able to inter link two process via the solution you propose.

A process needs to access an object defined and instantiated in another process.

What do you think ?
 Thank you very much in advance
 Best regards.
 MiQi.
Can you describe your need?
Actually, a process is isolated from other processes by definition. The only way to share the information is through the data transfer.

In other words, the shared information is or a persistent data structure (information from the stared database, shared file, etc.), or the active object is encapsulated in the dedicated (another) process, and you use some communication protocol to ask for the info and get the information back.
you may use named shared memory for your purpose, if the object is a data structure. either process could map to the shared memory by name. the first process would copy the shared data to the memory (with or without parameters to control access or synchronisation). either process could have a pointer to the shared instance.

if the object also is code, you could manage it in a service and provide data + functions.

Sara
ASKER CERTIFIED SOLUTION
Avatar of festijazz
festijazz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The Asker told us that they found a solution by using the .NET Framework.

I don't think that any of the other comments could be called a solution or assist.

Sara