Re: Singletons in Session...?

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hello laziers@xxxxxxxxx,

Could you explain what are u going to reach?

---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it" (c) Michelangelo


l> Hi,
l> It is a good practice to insert singletons in Session?
l> I have more than 5 singletons and Im not sure that inserting all in
l> session state is a good idee :|
l> singleton looks like this:
l> l> public class DAO
l> {
l> public static DAO Instance
l> {
l> get
l> {
l> if (System.Web.HttpContext.Current.Session["DAO"] ==
l> null)
l> {
l> System.Web.HttpContext.Current.Session["DAO"] =
l> new DAO();
l> }
l> return System.Web.HttpContext.Current.Session["DAO"]
l> as DAO;
l> }
l> }
l> private DAO() { }
l> }
l> bye.
l>


.



Relevant Pages

  • Singletons in Session...?
    ... It is a good practice to insert singletons in Session? ... session state is a good idee:| ... public class DAO ... public static DAO Instance ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Java DAO pattern: singleton and threadsafe?
    ... There's one abstract DAO ... That the DAOs are singletons and that there is one abstract superclass are orthogonal. ... I think a different connection should be gotten from the datasource ...
    (comp.lang.java.programmer)