PC Review


Reply
Thread Tools Rate Thread

ASP.NET singleton pattern question - urgent

 
 
Gaensh
Guest
Posts: n/a
 
      22nd Aug 2003
HI,
I have a singleton pattern to acess my database the following is
the sample code use to implement singleton pattern
public class DataAccessHelper
{
private static DataAccessHelper instance;
/// <summary>
/// public property that can only get the single instance of this
class.
/// </summary>
public static DataAccessHelper GetInstance
{
get
{ // Support multithreaded applications through
// "Double checked locking" pattern which avoids
// locking every time the method is invoked
if(instance == null)
{
// Only one thread can obtain a mutex
Mutex useMutex = new Mutex(true);
useMutex.WaitOne();
if(instance == null)
instance = new DataAccessHelper();
useMutex.Close();
}
return instance;
}
}
}
I am using this in my data layer and our application is 3 tier
application presentation is asp.net, business is webservice . ?
Q1. Does asp.net/webservice generate multithreaded scenario. ?
Q2. Does using mutex slowes the reponse time of the request. ?
Q3. Should singleton be used in asp.net scenario ?
Q4. Is ASP.Net / webservice is a multithreaded apllication ?

your feedback is very imporatant as the client feels that using
multithread scenario will not be encountered in asp.net/webservice and
using mutex will slow down the response of the request.

Thank you all in advance
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[abstract question] usage of Singleton pattern with C# Faust Microsoft C# .NET 4 20th Jul 2009 09:16 PM
singleton pattern donet programmer Microsoft ASP .NET 11 3rd Nov 2006 08:30 PM
How to create Singleton Pattern in VBA? Paul Microsoft Excel Programming 1 31st Oct 2006 04:38 AM
Singleton pattern for the web INeedADip Microsoft C# .NET 7 29th Jan 2006 05:05 PM
The singleton pattern Jonathan Rea Microsoft C# .NET 2 25th Oct 2004 03:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:33 PM.