The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Setting the connection on each page request or per app (DNN module)

Last post 06-05-2007, 8:50 AM by Scott.Schecter. 4 replies.
Sort Posts: Previous Next
  •  06-05-2007, 8:13 AM 3046

    Setting the connection on each page request or per app (DNN module)

    Hello,
     
    This may be a silly question but I may be doing this inefficiently.
     
    In your GetStarted manual it mentions Configless connections, and it has this sentence "Note that you only need to do this once for the life of your application."
     
    In the previous version of ES I was creating the connection in the Page_Init of every page (its the Poker League Management module on PokerDIY).
     
    Code:
            protected void Page_Init(object sender, System.EventArgs e)
            {
                new SmartThinker.DNN.Modules.League.Business.Utils().SetupESConnection();
            }

     
    Should I cache the connection (or a flag that it has been done once for this module already) once it has been set and check it each time? I do not have access to the web config or Global.asax. Or should I at the very least only instantiate it if it is not a postback?
      
    Thanks
    Rodney Joyce
    Smart-Thinker.com
    PokerDIY.com
  •  06-05-2007, 8:22 AM 3047 in reply to 3046

    Re: Setting the connection on each page request or per app (DNN module)

    Please see this post for all the info and a sample.

    Regards,

    Scott Schecter
    EntitySpaces | My Site
  •  06-05-2007, 8:24 AM 3048 in reply to 3047

    Re: Setting the connection on each page request or per app (DNN module)

    You only need to call that routine once from your view control init/load it sets it for the whole app domain. The routine I linked to checks, so it doesn't hurt to call it again.

    Regards,

    Scott Schecter
    EntitySpaces | My Site
  •  06-05-2007, 8:40 AM 3049 in reply to 3048

    Re: Setting the connection on each page request or per app (DNN module)

    Scott.Schecter:
    The routine I linked to checks, so it doesn't hurt to call it again.

    Ah ok - I was going to write something like this - I will move it into an "IsPostBack" check so it will cut down the calls a bit anyway.

    Thanks 

  •  06-05-2007, 8:50 AM 3050 in reply to 3049

    Re: Setting the connection on each page request or per app (DNN module)

    That is what I do as well...
    Code:
    if (!Page.IsPostBack)
    {
    	SetConnection();
    	//yada yada yada
    }


    Regards,

    Scott Schecter
    EntitySpaces | My Site
View as RSS news feed in XML