[dba-VB] OO Programming

Michael Maddison michael at ddisolutions.com.au
Fri Jul 8 20:32:59 CDT 2011


Hi,

I agree the service should have no UI component. Use a config file to
set paremeters.

It seems to be a filewatcher --> parser --> database updater service.
Another option for notifying the user UI application is SQLDependency.
http://msdn.microsoft.com/en-us/library/a52dhwx7%28v=vs.80%29.aspx 
I'm using this approach for the app I'm currently building (does not use
a service, though I did consider that.). 

A bit quirky to set up but so far so good!
Using this approach means that the service is completely separated from
any client UI apps. The UI's are notified by the SQL database when the
data changes or is inserted.
No polling required either.

Cheers

Michael M

Best prectice is for a service to not interact with the desktop in any
way. Your service and your GUI should be separate applications.  

The GUI and service should communicate with each other through some form
of Inter 
Process Communication (IPC).    If the server and GUI will always run on
the same 
workstation a good choice  would be file mapping using named shared
memory, (See
http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The
server can then use SendNotifyMessage() with HWND_BROADCAST  to tell
any active GUI to check for updated data in the mapped file.

--
Stuart

On 8 Jul 2011 at 14:23, Francisco Tapia wrote:

> Hey gang,
>   This thread I wanted to start to help cover some best practices when
>   it
> comes to programming, since we don't have a C# group I figured vb.net 
> is close enough :).  I was wondering how to approach my current 
> scenario.
> 
> I'm building a really rather simple windows service.  It monitors a 
> folder share on the network and whenever a new file is created it 
> takes a look at it and streams the contents to read for particular 
> pieces of data.  Once the target data is obtained, the stream is 
> closed and the data is then inserted into a Sql Server database.
> 
> simple.
> 
> I'm thinking that the threaded process should have some events it 
> advertises that the gui can hook into right?  the other way to get 
> this to work would be to just eliminate the gui updating from the 
> tread and have it read right off the log.txt file streamed in?  what 
> are your thoughts?


_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1388 / Virus Database: 1516/3751 - Release Date: 07/08/11




More information about the dba-VB mailing list