By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,207 Members | 1,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,207 IT Pros & Developers. It's quick & easy.

Shared Functions

P: n/a
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 !

--

Dec 3 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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
----------------------

"Confused !" wrote:
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 !

--

Dec 3 '05 #2

P: n/a
OK, so two people running the same code in a shared function is not going to
confuse things then ?

--

"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in message
news:35**********************************@microsof t.com...
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
----------------------

"Confused !" wrote:
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 !

--

Dec 3 '05 #3

P: n/a
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
Dec 3 '05 #4

P: n/a
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
"Confused !" <me@my.net> wrote in message
news:Oh****************@TK2MSFTNGP09.phx.gbl...
|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 !
|
| --
|
|
|
Dec 3 '05 #5

P: n/a
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

--
Best Regards

The Inimitable Mr Newbie
"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> wrote in
message news:O$****************@tk2msftngp13.phx.gbl...
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
"Confused !" <me@my.net> wrote in message
news:Oh****************@TK2MSFTNGP09.phx.gbl...
|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 !
|
| --
|
|
|

Dec 3 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.