R
Rick
A coworker has brought up the following quote from a book as
confirmation that we cannot use Singletons in ASP.Net application
code, at least at the ASP.Net tier.
I am looking for references to other documentation that confirms this
quote or refutes it or expert comment on whether to use a Singleton in
the ASP.Net web projects.
The following quote is from the book Programming Distributed
Applications with COM+ and Microsoft Visual Basic 6.0, Second Edition,
by Ted Pattison, Microsoft Press, 2000.
"An object that is shared across multiple clients is often called a
"singleton". Developers typically design with singletons in order to
share data across multiple clients. While the use of singleton objects
might be acceptable in some single-user scenarios, you should
definitely avoid it in COM+ applications. Every client should get its
own private objects. If multiple clients require access to the same
data, you should store this data in shared memory or in a database.
You can then devise a design in which each client creates a private
object that accesses this shared data." -- Chapter 7 "Sharing
Resources in a COM+ application".
I disagree with him as I have used Singletons before in ASP.Net code
and I thought they were working as intended. I haven't seen any
authoritative statement on MSDN or elsewhere, written specifically in
the context of ASP.Net and the .Net Framework that would indicate that
Singletons are incompatible with ASP.Net and cannot provide the
typical benefits of Singletons when used in ASP.Net Web Projects.
Thanks much,
Rick
confirmation that we cannot use Singletons in ASP.Net application
code, at least at the ASP.Net tier.
I am looking for references to other documentation that confirms this
quote or refutes it or expert comment on whether to use a Singleton in
the ASP.Net web projects.
The following quote is from the book Programming Distributed
Applications with COM+ and Microsoft Visual Basic 6.0, Second Edition,
by Ted Pattison, Microsoft Press, 2000.
"An object that is shared across multiple clients is often called a
"singleton". Developers typically design with singletons in order to
share data across multiple clients. While the use of singleton objects
might be acceptable in some single-user scenarios, you should
definitely avoid it in COM+ applications. Every client should get its
own private objects. If multiple clients require access to the same
data, you should store this data in shared memory or in a database.
You can then devise a design in which each client creates a private
object that accesses this shared data." -- Chapter 7 "Sharing
Resources in a COM+ application".
I disagree with him as I have used Singletons before in ASP.Net code
and I thought they were working as intended. I haven't seen any
authoritative statement on MSDN or elsewhere, written specifically in
the context of ASP.Net and the .Net Framework that would indicate that
Singletons are incompatible with ASP.Net and cannot provide the
typical benefits of Singletons when used in ASP.Net Web Projects.
Thanks much,
Rick