473,385 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Singleton in ASP.NET 2.0

Hi,

can anybody explain me if singletons can be used in ASP.NET 2.0
applications without being shared by multiple users/sessions? The
problem is that my application is using another library which
internally uses singletons, which should not be shared across multiple
users (one of the things they have in there is DB transaction manager).
Any suggestions would be greatly appreciated.

Regards,
Dmitry.
Mar 30 '06 #1
3 1290

I have a singleton (web style) object that I created to store objects.

http://spaces.msn.com/sholliday/ 10/24/2005 entry

My approach was that by piggy backing off the Session object... each
user gets their own version....much like a winform app would work.

I only store simple objects in mine .. (aka, what I've tested)....
mainly dealing with UI ... how I move from 1 page to the next with out
hard coded hrefs in the pages.

Anyway, take a look....but I'd say the idea is that you'd have 1 per
user.. by piggybacking off the Session object.

I use guids for my Users to ensure no conflicts, fyi.

Dmitry wrote:
Hi,

can anybody explain me if singletons can be used in ASP.NET 2.0
applications without being shared by multiple users/sessions? The
problem is that my application is using another library which
internally uses singletons, which should not be shared across multiple
users (one of the things they have in there is DB transaction manager).
Any suggestions would be greatly appreciated.

Regards,
Dmitry.


Mar 30 '06 #2
Singletons is a design pattern.they can be used with asp.net if designed
correctly.

the issues with asp.net is that thread local storage can not be used as the
thread can change while processing the request (casing the data to
disappear). if your library has any static variables, and they are not to be
shared across all thread and users then your library won't work.

-- bruce (sqlwork.com)

"Dmitry" <dp******@gmail.com> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
Hi,

can anybody explain me if singletons can be used in ASP.NET 2.0
applications without being shared by multiple users/sessions? The problem
is that my application is using another library which internally uses
singletons, which should not be shared across multiple users (one of the
things they have in there is DB transaction manager). Any suggestions
would be greatly appreciated.

Regards,
Dmitry.

Mar 30 '06 #3
Thanks Bruce,

I guess I'm in trouble now. But what about all those rumors that ASP.NET
sessions would run in separate app domains, not threads? That would
ensure that address space is not shared between different sessions?..

Bruce Barker wrote:
Singletons is a design pattern.they can be used with asp.net if designed
correctly.

the issues with asp.net is that thread local storage can not be used as the
thread can change while processing the request (casing the data to
disappear). if your library has any static variables, and they are not to be
shared across all thread and users then your library won't work.

-- bruce (sqlwork.com)

"Dmitry" <dp******@gmail.com> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
Hi,

can anybody explain me if singletons can be used in ASP.NET 2.0
applications without being shared by multiple users/sessions? The problem
is that my application is using another library which internally uses
singletons, which should not be shared across multiple users (one of the
things they have in there is DB transaction manager). Any suggestions
would be greatly appreciated.

Regards,
Dmitry.


Mar 30 '06 #4

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

Similar topics

10
by: E. Robert Tisdale | last post by:
Could somebody please help me with the definition of a singleton? > cat singleton.cc class { private: // representation int A; int B; public: //functions
3
by: Alicia Roberts | last post by:
Hello everyone, I have been researching the Singleton Pattern. Since the singleton pattern uses a private constructor which in turn reduces extendability, if you make the Singleton Polymorphic...
5
by: Pelle Beckman | last post by:
Hi, I've done some progress in writing a rather simple singleton template. However, I need a smart way to pass constructor arguments via the template. I've been suggested reading "Modern C++...
3
weaknessforcats
by: weaknessforcats | last post by:
Design Pattern: The Singleton Overview Use the Singleton Design Pattern when you want to have only one instance of a class. This single instance must have a single global point of access. That...
3
by: stevewilliams2004 | last post by:
I am attempting to create a singleton, and was wondering if someone could give me a sanity check on the design - does it accomplish my constraints, and/or am I over complicating things. My design...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.