Option 2:

A windows service (as far as .Net is concerned) is any executable assembly that 
exposes a class derived from ServiceBase.

 

I normally have my services written as a Console Application. Then, when the 
console app is run, if it’s an interactive session then I manually start the 
service (serviceinstance.start();) otherwise it’s running as a windows service 
and call (ServiceBase.Run(serivceInstance);)

 

With the above, it’s easy to have your cake and eat it at the same time. Run it 
from startup, a desktop shortcut, any other way you can imagine (using win32 
p/invoke to hide if you really like) or have windows host it..

 

From: [email protected] [mailto:[email protected]] On 
Behalf Of Greg Keogh
Sent: Wednesday, 11 November 2015 3:17 PM
To: ozDotNet <[email protected]>
Subject: Sharing a database file

 

Howdy again, I'm thinking aloud about a problem here in case there is lateral 
thinking available.

 

We have a mature app that uses a single-file database that is locked. Now new 
apps want to use this file as well, but how can they share it? The usual fix 
would be to (1) Migrate it into something like SQL Server (2) Wrap the file in 
code in a different process and expose it as a service.

 

Option 1 has too many dependencies that aren't available. Option 2 is easy to 
code, but you have to manage the lifetime of the process and perhaps make it a 
Windows Service, which makes a bigger install and runtime footprint.

 

At the moment I'm wondering if the "service" could be a hidden console or 
WinForms app that is registered in HKLM Run, or similar. That way it's a "fake 
lightweight service".

 

Greg K

Reply via email to