You can check this article out:
5/24/2006
Custom Objects/Collections and Tiered Development
http://sholliday.spaces.live.com/
Some additional thoughts.
Make sure you do some locking with the Singleton.
Or abandon the Singleton thinking altogether.
How are you writing an Asp.Net singleton?
See
10/24/2005
Web Session Wrapper for storing and retrieving objects
Make sure you close your IDataReaders. Don't reuse connection objects.
It is less expensive to start a new connection object, then to tear one down
and build it back up.
I'd take a deep look at the first blog entry above, and then read the MS
article I mention at the bottom of that article.
On my blog, pay attention to the "SqlHelper is a substitute of your
application's data layer object".
I'd abandon a Singleton as a database class. Its more important to
Open LATE
Use quickly.
Close quickly.
Make sure you close and don't let connections linger. This is where I think
youre singleton is probably screwing you.
"Guy Thornton" <wdonotspamthornton@incresearch.comwrote in message
news:E7A77FC9-2F1A-4188-814D-1FE77659E9EF@microsoft.com...
Quote:
I have an application in asp.net using vb.
>
The asp.net portion of this application is mainly the user interface. The
UI has references made to our business logic layer. And the business
logic
Quote:
layer uses a database class to access our data environment.
>
The business logic layer and database class is compiled into a class
library. The database class is a single class that contains all of our
queries there. It is implemented following the Singleton pattern so there
should only be 1 instance of the class.
>
The problem we are having is when multiple users start hitting the web
site,
Quote:
we get very erratic errors to occur at different points within the
application. All errors are System.InvalidOperationException. Invalid
attempt to read when reader is closed.
>
The application runs fine with 1 user on the system. So I know that the
code logic is ok. I am concerned that because I implemented a Singleton
database class, that all users in the system are trying to share that 1
class
Quote:
instance.
>
Has anybody encountered this before?
Does anyone have any suggestions for me?
>
Some questions I would love to hear about are
1. When using class libraries, is a copy of the object model unique only
at
Quote:
the application level or at the session level?
2. Is there a way to specify at what level an object model may live
within
Quote:
an asp.net app?
>
Any feedback someone may have would greatly be appreciated. We have
rather
Quote:
hit a wall here and do not know how to continue.
>
Thanks.