Shared Functions

  • Thread starter Thread starter Confused !
  • Start date Start date
C

Confused !

I am writing an ASP.NET application and I want to use shared members on the
data layer to retreive information from the SQL Server.

If I declare a Function to be Shared, how will this affect things in a multi
user environment. In other words, are my shared classes for the want of a
better word. "Instantiated" for each user.

Hope this makes sense !

--
 
Hi,

We use a shared function in our website for data access. You do not
need to create an instance of the class to use it. You can just call
YourClass.YourSharedFunction to use it.

Ken
 
OK, so two people running the same code in a shared function is not going to
confuse things then ?
 
Confused,

An shared class on a webpage is shared by all active users. You can use it
by instance for reading data that you don't will not be updated on a
regular base. By instance articel name list or things like that, from which
the information has not to be exact on time. By instance not the stock or
price of things that can change very quick.

Never use it for data that you want to update or whatever.

In our situation using it is therefore no problem, however as soon as we do
an update, than we set the dataset to nothing with a seperate webpage,
therefore the dataset will than completely be read again.

In the procedure is in pseudo something as
\\\
If dataset is nothing then
fill(dataset)
return dataset
else
return dataset
end if.
////

I hope this explains it.

Cor
 
Confused !,
In addition to the other comments.

Shared functions won't be a problem, especially when they only refer to
parameters & local variables (non static local variables that is)

Its when the Shared functions relay on Shared fields or local Static
variables that can be the problem. As Shared fields & local Static variables
can be accessed by each request & require special consideration...


--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


|I am writing an ASP.NET application and I want to use shared members on the
| data layer to retreive information from the SQL Server.
|
| If I declare a Function to be Shared, how will this affect things in a
multi
| user environment. In other words, are my shared classes for the want of a
| better word. "Instantiated" for each user.
|
| Hope this makes sense !
|
| --
|
|
|
 
OK, thanks. I will want to update the SQL server as well as read from it.
Providing the variable ( Including datasets etc ) are not static then this
should not be a problem
 

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

Back
Top