[dba-VB] C# Sysvars

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Wed Jul 21 09:43:25 CDT 2010


Hi John --

You probably mean handling "Locking and Thread Safety"
 http://www.albahari.com/threading/part2.aspx#_Locking

or "best practices" in implementing of Singleton pattern

http://www.yoda.arachsys.com/csharp/singleton.html

while using your Sysvars
?

-- Shamil

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Tuesday, July 20, 2010 11:17 PM
To: VBA
Subject: [dba-VB] C# Sysvars

In Access I had a system for handling what I call SysVars, which are program
global variables, 
stored in a table, cached as the program opens.

SysVar
VarID - Int - surrogate key
VarName - Str - name of the variable
VarVal - Str - Value of the variable
VarDescr - Str - description of how the variable is used
VarRefresh - Bool - needs to be refreshed before use.

This essentially replaces what many developers use, a single record in a
table where you add a new 
field every time you need a new variable (yuk).

Just as an example...

I have an asynchronous process where I:

1) Send 2 million record chunks of data to files on disk.
2) Ship the chunk files over to a VM input directory for processing
3) Process each file, placing the processed result files in an output
directory.
4) Watch the output directory for processed files and ship back to the
server
5) Import the chunks back in to SQL Server.

The problem is that step 3 takes about 1 hour per file.  If I run this
process on a large table I 
can export 30 files to the VM which translates into 30 hours before it
finishes processing.

If I get a rush order, I need to delete the files in the VM so that they are
not clogging up the 
works and not automatically send those files back to the VM until I say so.

I have a SysVar called VMHold which is a true / false, true if hold files
going to the vm and false 
if not.  I can set / reset this sysvar through a sysvars class, and it reads
/ writes the value to 
the sql server tlbSysVars, caching them in memory as the program opens,
refreshing them before use 
ONLY if the varRefresh is true.

That is what I call SysVars and how / why I use them.  It seems like
everyone would use these for 
any moderately complex asynchronous or multi-user program.

I am looking for feedback on how others implement this functionality.  I
will write a second email 
regarding some of the issues I am running into.

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




More information about the dba-VB mailing list