Click here to Skip to main content
15,880,299 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
I have a DatabaseConnection dll which does the following...(1)connect (2)disconnect (3) ping/reestablish connection (4) do query (5) etc. It's some sort of wrapper of the MySql.dll just customized to meet what I just need.

Now, the DatabaseConnection will be referenced on another system.
DatabaseConnection is Window less. Now, I have this plan to provide a window tool within the same namespace with the DatabaseConnection that can be called/run anytime even if DatabaseConnection is already instantiated. It's purpose is to provide a debugging/logging tool (some sort of a query analyzer) for DatabaseConnection.

My concern is, if DatabaseConnection is already instantiated/run as a process on another system, how would I synchronize my Window (QueryAnalyzer/Logging) Tool anytime if the DatabaseConnection is already instantiated/a process?

By the way through this, I can dispose the window without disposing the DatabaseConnection object; Instantiate the window again without affecting the data in the DatabaseConnection object, and vice versa. The window is just like an accessory.

NOTE: I am excluding the idea to merge the DatabaseConnection with the window and just hide it.
Posted
Comments
johannesnestler 18-Feb-11 7:43am    
sounds confusing... think about a service instead. connect your Window with the service, and let the service call DatabaseConnection. - Only a quick thought...

1 solution

If you just want to exchange data between your processes, then you may use pipes. Have a look to that page to see how they work:
http://msdn.microsoft.com/en-us/library/bb546102.aspx[^]

To use pipes, you need a server and a client application. I suggest that your DatabaseConnection be the server since it will be started first.

However pipes will allow you to send and receive data, not share objects as you asked.

As far as I know you can't share an instance of an object between two different processes because they don't share the same address space (sharing between threads is OK because threads are executing within the process' space).

What I suggest is to use pipes to send requests from the UI, these requests will then be interpreted from another dedicated class in your DatabaseConnection and will send the result back to the UI.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900