P
Peter Row
Hi,
I have a VB6 webclass app that was ported to VB.NET.
However due to multithreading now being used the global variables used have
come to haunt me.
Problem:
I have a handful of global variables:
A asp context wrapper object
A database wrapper object
A couple of others.
The reason that the context and db access objects are global is because a
lot of functions, methods etc...
need to use them and passing them in having creating them locally would be
ridculous.
i.e. I have the following functions/sub,
FuncA()
....some code
SubB()
.....more code
End Func
SubB()
....some code
..... asp context object usage
.... more code
....FuncC()
End Sub
FuncC()
.... some code
.... data access object usage
.... mode code
End FuncC()
Therefore in order for this to work the definitions would need to be:
FuncA( AspContext, DatabaseWrapper )
SubB( AspContext, DatabaseWrapper )
FuncC( DatabaseWrapper)
.... which to me is absolutely ridiculous. FuncA() doesn't use any of the
params it has,
SubB only uses one of its parameters.
This would be a nightmare, even if I made a containing structure that had
each of the objects.
Is there anyway that I can have object variables that are visible to all my
other funcs/subs/methods
but are local to the currently executing thread?
Regards,
Peter Row
I have a VB6 webclass app that was ported to VB.NET.
However due to multithreading now being used the global variables used have
come to haunt me.
Problem:
I have a handful of global variables:
A asp context wrapper object
A database wrapper object
A couple of others.
The reason that the context and db access objects are global is because a
lot of functions, methods etc...
need to use them and passing them in having creating them locally would be
ridculous.
i.e. I have the following functions/sub,
FuncA()
....some code
SubB()
.....more code
End Func
SubB()
....some code
..... asp context object usage
.... more code
....FuncC()
End Sub
FuncC()
.... some code
.... data access object usage
.... mode code
End FuncC()
Therefore in order for this to work the definitions would need to be:
FuncA( AspContext, DatabaseWrapper )
SubB( AspContext, DatabaseWrapper )
FuncC( DatabaseWrapper)
.... which to me is absolutely ridiculous. FuncA() doesn't use any of the
params it has,
SubB only uses one of its parameters.
This would be a nightmare, even if I made a containing structure that had
each of the objects.
Is there anyway that I can have object variables that are visible to all my
other funcs/subs/methods
but are local to the currently executing thread?
Regards,
Peter Row