HttpApplication instance

G

Guest

I connect to myDataStore from different places but I really only need to
connect once when the application loads.

'Connect to database.
Dim myDataStore As IDataStore = New eBiz.SDK.Integration.DataStore
myDataStore .Connect(connStr)

Can I also store the IDataStore object in my HttpApplication instance. If
so, how? Also, how would I call myDataSore from other pages. Or should I say,
how do I then have access to myDataSore from other pages or classes.

Sincerely,

Stan Alex
 
G

Guest

I suppose you could add a "public static IDataStore myDataStore;" to the
Global class in Global.asax.cs (or the equivalent in VB). Then from any page
you could reference it by typing Global.myDataStore.

However, I believe that this may not a good idea (not knowing anything about
the class), in that it disregards any possible threading issues.

Is it horribly expensive to instantiate a eBiz.SDK.Integration.DataStore?
How often do you need to use it? You might want to rethink your approach.
 
G

Guest

Hi Brad,

Thank you very much for your reply. Actually, I am using an SDK and I do not
know how expensive it is to keep recreating the object. But since you brought
it up, what were the possible threading issues that are disregarded?

Also, by what you are suggesting, just because this may be an object that
anyone who logs in will use, do not just assume that the correct answer is to
instantiate the object in Global.asax. Is this correct?
 
J

John Saunders

Stanley Alex said:
Hi Brad,

Thank you very much for your reply. Actually, I am using an SDK and I do not
know how expensive it is to keep recreating the object. But since you brought
it up, what were the possible threading issues that are disregarded?

The threading issues are simple: this will be one single object being used
by multiple page requests, from multiple users, all at the same time. Does
the object support this? Does the object perform proper synchronization such
that two requests making different calls to the object at the same time
don't interfere with each other?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top