473,769 Members | 6,653 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Shared Functions

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. "Instantiat ed" for each user.

Hope this makes sense !

--

Dec 3 '05 #1
5 4394
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.YourS haredFunction 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. "Instantiat ed" for each user.

Hope this makes sense !

--

Dec 3 '05 #2
OK, so two people running the same code in a shared function is not going to
confuse things then ?

--

"Ken Tucker [MVP]" <Ke**********@d iscussions.micr osoft.com> wrote in message
news:35******** *************** ***********@mic rosoft.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.YourS haredFunction 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. "Instantiat ed" for each user.

Hope this makes sense !

--

Dec 3 '05 #3
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
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******** ********@TK2MSF TNGP09.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. "Instantiat ed" for each user.
|
| Hope this makes sense !
|
| --
|
|
|
Dec 3 '05 #5
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$******** ********@tk2msf tngp13.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******** ********@TK2MSF TNGP09.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. "Instantiat ed" for each user.
|
| Hope this makes sense !
|
| --
|
|
|

Dec 3 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1961
by: MPF | last post by:
When designing a n-tier architecture, what is the preferred method/function accessibility? <Specifically for asp.net apps> A private constructor and shared/static methods & functions? A public constructor and non-shared/static methods & functions? Are there any drawbacks with regards to performance with either model? Thanks,
3
1803
by: Ford Prefect alias Armin | last post by:
Hello I use SHARED Sub's and Functions to access Data from all running Sessions. I use the KeyWord Shared in the Functions of the Class. This is working fine.. an I can share Data between all Sessions. Are there any known Problems with this in Web ? Is this the right way ?
11
3361
by: tshad | last post by:
I am setting up some of my functions in a class called MyFunctions. I am not clear as to the best time to set a function as Shared and when not to. For example, I have the following bit manipulation routines in my Class: ******************************************************************************* imports System NameSpace MyFunctions
15
4944
by: Rob Nicholson | last post by:
A consequence of the ASP.NET architecture on IIS has just hit home with a big thud. It's to do with shared variables. Consider a module like this: Public Module Functions Public GlobalName As String ' this is ineffect a global application object End Module
4
45175
by: Chris | last post by:
Hello, I'm just getting started with VB and am new to the group, so please excuse what may seem to be a rudimentary question. I've been writing basic programs and have noticed that the syntax for some of these functions have been set up with the keywords "Public Shared Function" (for example, the Trim function) and others are set up just as "Public
10
305
by: Stevie_mac | last post by:
Hi all, quick question - I need a bit of clarity. If I have a public class with only Public Shared functions in it, in an APS.NET web app (for common procedures) is it safe (since multiple web pages, can at any time access the code within) Example below - a simple routine that fills a dropdownlist or list. Would it be safe being accessed at multiple times by the APSX pages? I think so, but I need an a more knowledgeable opinion. ...
4
3362
by: Rubbrecht Philippe | last post by:
Hi there, I would like to develop an interface that when implemented in a class requires a number of shared properties or methods to be available. It seems a Shared Member can not be used as interface member implementation?! Is there a workaround to this problem?! Best regards, Philippe Rubbrecht
10
2114
by: tshad | last post by:
I have a Dll I created in VS 2000. The namespace is MyFunctions and the Class is CryptoUtil. I have a program that is using the Class but it can't access it directly. I have a class (below) called CryptoUtil. The functions are Shared functions. I have this Dll in the bin folder of my program. If I don't reference it - it can't seem to find it. If I have:
1
1186
by: Nathan Sokalski | last post by:
I have a class that is just a bunch of Shared functions (basically, a bunch of utilities I have grouped together). However, there are functions that I want to write to use inside some of these Shared members that I do not want available outside the class. Here is the basic layout of my class: Public Class Utilities Public Shared Function Utility1() As String End Function
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.